فهرست منبع

LibHTML: Fix relative URL completion when document URL ends in a slash

Andreas Kling 5 سال پیش
والد
کامیت
ebacef36ee
1فایلهای تغییر یافته به همراه4 افزوده شده و 1 حذف شده
  1. 4 1
      Libraries/LibHTML/DOM/Document.cpp

+ 4 - 1
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('/');