From 105745e31289819da9c0181b5cec0cffbedd7d86 Mon Sep 17 00:00:00 2001 From: "kmcclusk%netscape.com" Date: Thu, 20 Aug 1998 20:32:52 +0000 Subject: [PATCH] Added XP_UNIX code to leave the top slash for absolute file paths under UNIX. This fixes a problem where all of the slashs get stripped off because the URL is asked to parse a previously parsed url string. --- network/module/nsURL.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/network/module/nsURL.cpp b/network/module/nsURL.cpp index 3a46b9147930..93b99307e8bb 100644 --- a/network/module/nsURL.cpp +++ b/network/module/nsURL.cpp @@ -503,6 +503,22 @@ nsresult URLImpl::ParseURL(const nsIURL* aURL, const nsString& aSpec) return NS_ERROR_ILLEGAL_VALUE; } + +#ifdef XP_UNIX + // Always leave the top level slash for absolute file paths under UNIX. + // The code above sometimes results in stripping all of slashes + // off. This only happens when a previously stripped url is asked to be + // parsed again. Under Win32 this is not a problem since file urls begin + // with a drive letter not a slash. This problem show's itself when + // nested documents such as iframes within iframes are parsed. + + if (PL_strcmp(mProtocol, "file") == 0) { + if (*cp != '/') { + cp--; + } + } +#endif + const char* cp0 = cp; if ((PL_strcmp(mProtocol, "resource") == 0) || (PL_strcmp(mProtocol, "file") == 0)) {