aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index 829216a..c330eb0 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -552,11 +552,20 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
// Only cache text pages
bool will_cache = true;
+ // We always give trailing slashes to the renderers
+ // since QUrl.resolve will not create absolute URLs properly
+ // without them.
+ QUrl cur_url = current_location;
+ if (cur_url.path().isEmpty())
+ cur_url.setPath("/");
+ else if (cur_url.path()[cur_url.path().length() - 1] != "/")
+ cur_url.setPath(cur_url.path() + "/");
+
if (not plaintext_only and mime.is("text", "gemini"))
{
document = GeminiRenderer::render(
data,
- this->current_location,
+ cur_url,
doc_style,
this->outline,
&this->page_title);
@@ -565,7 +574,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
{
document = GophermapRenderer::render(
data,
- this->current_location,
+ cur_url,
doc_style);
}
else if (not plaintext_only and mime.is("text","html"))
@@ -611,7 +620,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
document = GeminiRenderer::render(
src.readAll(),
- this->current_location,
+ cur_url,
preview_style,
this->outline);
@@ -624,7 +633,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
{
document = MarkdownRenderer::render(
data,
- this->current_location,
+ cur_url,
doc_style,
this->outline,
this->page_title);
@@ -671,7 +680,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
else if (mime.is("video") or mime.is("audio"))
{
doc_type = Media;
- this->ui->media_browser->setMedia(data, this->current_location, mime.type);
+ this->ui->media_browser->setMedia(data, cur_url, mime.type);
will_cache = false;
}
@@ -713,7 +722,7 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
document = GeminiRenderer::render(
page_data.toUtf8(),
- this->current_location,
+ cur_url,
doc_style,
this->outline,
&this->page_title);