mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Rewrite the request interceptor.
It seems that there are request in the form "blob://foo.zim/<uuid>". I don't know where it come from, we cannot handle it and even Qt is parsing it wrongly (scheme and host are empty, path is the full url request). By using a string to handle the url, it is simpler to change "http://" to "zim://".
This commit is contained in:
parent
fab22ab909
commit
4849b5e364
@ -14,10 +14,12 @@ void KiwixRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
|
||||
{
|
||||
std::cout << "Intercept request" << std::endl;
|
||||
auto url = info.requestUrl();
|
||||
std::cout << " - " << url.toString().toUtf8().constData() << std::endl;
|
||||
url.setScheme("zim");
|
||||
std::cout << " + " << url.toString().toUtf8().constData() << std::endl;
|
||||
info.redirect(url);
|
||||
|
||||
auto urlString = url.toString();
|
||||
std::cout << " - " << urlString.toUtf8().constData() << std::endl;
|
||||
if (urlString.startsWith("http://")) {
|
||||
urlString.replace(0, 7, "zim://");
|
||||
}
|
||||
std::cout << " + " << urlString.toUtf8().constData() << std::endl;
|
||||
info.redirect(QUrl(urlString));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user