Improve path normalisation with separate substitutions
This change reverts the original regex and simply adds a second regex which is called on the result. '/\./' is one literal forward slash, one literal fullstop (escaped with a leading backslash), and one literal forward slash. In plain text, `/./` will be replaced with `/`.
This commit is contained in:
parent
73527d3f14
commit
ab301801b0
@ -24,7 +24,8 @@ endif
|
|||||||
function! vimwiki#path#normalize(path) abort
|
function! vimwiki#path#normalize(path) abort
|
||||||
let path = a:path
|
let path = a:path
|
||||||
while 1
|
while 1
|
||||||
let result = substitute(path, '/[^/]\+/\.\.\|\./', '', '')
|
let intermediateResult = substitute(path, '/[^/]\+/\.\.', '', '')
|
||||||
|
let result = substitute(intermediateResult, '/\./', '/', '')
|
||||||
if result ==# path
|
if result ==# path
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user