From 5b9b61417102f6cd2819b3cece81908ea49e7a21 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. git-svn-id: svn://10.0.0.236/trunk@8261 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/network/module/nsURL.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mozilla/network/module/nsURL.cpp b/mozilla/network/module/nsURL.cpp index 3a46b914793..93b99307e8b 100644 --- a/mozilla/network/module/nsURL.cpp +++ b/mozilla/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)) {