Fix path compression to include removing "/./".

- This involved a fix to the FTP scripts that relied on the old behavior.
This commit is contained in:
Seth Hall 2013-04-02 00:16:56 -04:00
parent d11a1dab73
commit f1d165956a
3 changed files with 12 additions and 6 deletions

View file

@ -19,7 +19,7 @@ function extract_path(input: string): string
}
## Compresses a given path by removing '..'s and the parent directory it
## references and also removing '/'s.
## references and also removing dual '/'s and extraneous '/./'s.
## dir: a path string, either relative or absolute
## Returns: a compressed version of the input path
function compress_path(dir: string): string
@ -41,7 +41,7 @@ function compress_path(dir: string): string
return compress_path(dir);
}
const multislash_sep = /(\/){2,}/;
const multislash_sep = /(\/\.?){2,}/;
parts = split_all(dir, multislash_sep);
for ( i in parts )
if ( i % 2 == 0 )