summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-02 16:37:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-02 16:41:29 +0100
commit3e7afe0037d6d165abbeb32d4e5fb68ac8a9aeea (patch)
treea191cf4f0d9c4087ec0caa311d232b1aea5544e8 /sal
parentbf18f1b3535dd17f9bf584cab15ee6a7fd431257 (diff)
Clean up osl_getSystemPathFromFileURL handling of relative //... URLs
(i.e., starting with an authority component); treating input starting with a single slash (i.e., starting with an absolute path component) as a relative URL instead of as an absolute pathname would cause e.g. CppunitTest_sal_osl_file to fail Change-Id: Ie340881974c5e9451ab7e0a9bfb21176b8f5666d
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/file_url.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sal/osl/unx/file_url.cxx b/sal/osl/unx/file_url.cxx
index 45e96e72e173..1d8c1fd0314b 100644
--- a/sal/osl/unx/file_url.cxx
+++ b/sal/osl/unx/file_url.cxx
@@ -88,8 +88,13 @@ oslFileError SAL_CALL osl_getSystemPathFromFileURL( rtl_uString *ustrFileURL, rt
sal_Unicode encodedSlash[3] = { '%', '2', 'F' };
- /* a valid file url may not start with '/' */
- if( ( 0 == ustrFileURL->length ) || ( '/' == ustrFileURL->buffer[0] ) )
+ // For compatibility with assumptions in other parts of the code base,
+ // assume that anything starting with a slash is a system path instead of a
+ // (relative) file URL (except if it starts with two slashes, in which case
+ // it is a relative URL with an authority component):
+ if (ustrFileURL->length == 0
+ || (ustrFileURL->buffer[0] == '/'
+ && (ustrFileURL->length == 1 || ustrFileURL->buffer[1] != '/')))
{
return osl_File_E_INVAL;
}