summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-11-01 22:14:07 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-11-01 22:14:07 +0100
commit059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0 (patch)
treed2cbc6021e55c1728131c7e146fd068906846f04
parentf62eee7c510238bf93b6ad43acd8b8a79a44417c (diff)
downloadUXP-059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0.tar
UXP-059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0.tar.gz
UXP-059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0.tar.lz
UXP-059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0.tar.xz
UXP-059397bdd2b8eaaa7f2bbacb9ce415aba8db91b0.zip
Remove Query/Ref from the directory listing URI.
Port of Bug 1488061.
-rw-r--r--netwerk/streamconv/converters/nsIndexedToHTML.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
index 0414c4841..29fea8bfb 100644
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -146,7 +146,14 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
nsAutoCString baseUri, titleUri;
rv = uri->GetAsciiSpec(baseUri);
if (NS_FAILED(rv)) return rv;
- titleUri = baseUri;
+
+ nsCOMPtr<nsIURI> titleURL;
+ rv = uri->Clone(getter_AddRefs(titleURL));
+ if (NS_FAILED(rv)) titleURL = uri;
+ rv = titleURL->SetQuery(EmptyCString());
+ if (NS_FAILED(rv)) titleURL = uri;
+ rv = titleURL->SetRef(EmptyCString());
+ if (NS_FAILED(rv)) titleURL = uri;
nsCString parentStr;
@@ -170,16 +177,14 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
// that - see above
nsAutoCString pw;
- rv = uri->GetPassword(pw);
+ rv = titleURL->GetPassword(pw);
if (NS_FAILED(rv)) return rv;
if (!pw.IsEmpty()) {
nsCOMPtr<nsIURI> newUri;
- rv = uri->Clone(getter_AddRefs(newUri));
+ rv = titleURL->Clone(getter_AddRefs(newUri));
if (NS_FAILED(rv)) return rv;
rv = newUri->SetPassword(EmptyCString());
if (NS_FAILED(rv)) return rv;
- rv = newUri->GetAsciiSpec(titleUri);
- if (NS_FAILED(rv)) return rv;
}
nsAutoCString path;
@@ -247,6 +252,11 @@ nsIndexedToHTML::DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
}
}
+ rv = titleURL->GetAsciiSpec(titleUri);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
+
buffer.AppendLiteral("<style type=\"text/css\">\n"
":root {\n"
" font-family: sans-serif;\n"