summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOM/Document.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-10 11:35:38 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-10 11:35:38 +0200
commitebacef36ee8639b03e8bd8096cfa54676f2e3432 (patch)
treed7623b1385bca717e349ee2f7f2250bc46782909 /Libraries/LibHTML/DOM/Document.cpp
parent796e63b34c099601addd3e05641c61e225e7a08c (diff)
downloadserenity-ebacef36ee8639b03e8bd8096cfa54676f2e3432.zip
LibHTML: Fix relative URL completion when document URL ends in a slash
Diffstat (limited to 'Libraries/LibHTML/DOM/Document.cpp')
-rw-r--r--Libraries/LibHTML/DOM/Document.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibHTML/DOM/Document.cpp b/Libraries/LibHTML/DOM/Document.cpp
index 3312f2c21c..a9589c0686 100644
--- a/Libraries/LibHTML/DOM/Document.cpp
+++ b/Libraries/LibHTML/DOM/Document.cpp
@@ -113,8 +113,11 @@ URL Document::complete_url(const String& string) const
FileSystemPath fspath(m_url.path());
StringBuilder builder;
builder.append('/');
+
+ bool document_url_ends_in_slash = m_url.path()[m_url.path().length() - 1] == '/';
+
for (int i = 0; i < fspath.parts().size(); ++i) {
- if (i == fspath.parts().size() - 1)
+ if (i == fspath.parts().size() - 1 && !document_url_ends_in_slash)
break;
builder.append(fspath.parts()[i]);
builder.append('/');