Change uses of direct paths in Server to use toLocalPath to deconvert encoded absolute paths.
For Windows:
We convert to slashes, then if it does not start with a slash, we add one at the start. So, when decoding paths, we have to check if after FromSlash removing the leading backslashes produces an absolute path. If it does, then we return that instead.
We switch to using filepath.Clean first before filepath.ToSlash so that clients work consistently. ( \\UNC\Path paths work on clients that do not FXP_REALPATH sanitize first, while for those that do, path.Clean would otherwise strip out the double slash start.)
For Plan9:
Some absolute paths (those that start with #) get prefixed with a slash in cleanPath, using filepath.Clean first should avoid accidentally dropping the #, and then we make sure a leading / will get removed if added from the “add a starting slash” encoding .
Plan9 wasn’t compiling because s_ISVTX was typoed as S_ISVTX
All other OSes:
toLocalPath just returns the path. There’s nothing further to be done for it.
Change uses of direct paths in
Server
to usetoLocalPath
to deconvert encoded absolute paths.For Windows:
FromSlash
removing the leading backslashes produces an absolute path. If it does, then we return that instead.filepath.Clean
first beforefilepath.ToSlash
so that clients work consistently. (\\UNC\Path
paths work on clients that do notFXP_REALPATH
sanitize first, while for those that do,path.Clean
would otherwise strip out the double slash start.)For Plan9:
#
) get prefixed with a slash incleanPath
, usingfilepath.Clean
first should avoid accidentally dropping the#
, and then we make sure a leading/
will get removed if added from the “add a starting slash” encoding .s_ISVTX
was typoed asS_ISVTX
All other OSes:
toLocalPath
just returns the path. There’s nothing further to be done for it.