Skip to content

Commit ebacef3

Browse files
committed
LibHTML: Fix relative URL completion when document URL ends in a slash
1 parent 796e63b commit ebacef3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Libraries/LibHTML/DOM/Document.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,11 @@ URL Document::complete_url(const String& string) const
113113
FileSystemPath fspath(m_url.path());
114114
StringBuilder builder;
115115
builder.append('/');
116+
117+
bool document_url_ends_in_slash = m_url.path()[m_url.path().length() - 1] == '/';
118+
116119
for (int i = 0; i < fspath.parts().size(); ++i) {
117-
if (i == fspath.parts().size() - 1)
120+
if (i == fspath.parts().size() - 1 && !document_url_ends_in_slash)
118121
break;
119122
builder.append(fspath.parts()[i]);
120123
builder.append('/');

0 commit comments

Comments
 (0)