diff options
| author | Dominic Della Valle <ddvpublic@Gmail.com> | 2026-07-26 07:18:57 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-26 07:18:57 -0400 |
| commit | 4a5062cda69fa6cb59b7dc0c488dfb05accf99de (patch) | |
| tree | 7a7fb63e02454383e0bb13d39d083dcbe8fe3860 /test/functional/vimscript | |
| parent | dec3d8215dfa5d1ffd3a7d1d06559290db3cffcf (diff) | |
| download | rneovim-4a5062cda69fa6cb59b7dc0c488dfb05accf99de.tar.gz rneovim-4a5062cda69fa6cb59b7dc0c488dfb05accf99de.tar.bz2 rneovim-4a5062cda69fa6cb59b7dc0c488dfb05accf99de.zip | |
fix(path): DOS device path check #40976
Problem:
The current check is intended to match DOS device paths starting with
`\\?` or `\\.` but will match any path starting with `?` or `.`,
including relative paths such as `.\`.
This is because the leading slashes are removed before the comparison.
Solution:
Changes the check to include the path's prefix, assuring the path has
the correct amount of separators for a DOS device path.
Diffstat (limited to 'test/functional/vimscript')
| -rw-r--r-- | test/functional/vimscript/fnamemodify_spec.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/functional/vimscript/fnamemodify_spec.lua b/test/functional/vimscript/fnamemodify_spec.lua index 65a1ec72e9..c9b93dd31d 100644 --- a/test/functional/vimscript/fnamemodify_spec.lua +++ b/test/functional/vimscript/fnamemodify_spec.lua @@ -182,6 +182,11 @@ describe('fnamemodify()', function() eq('//?/UNC/server', fnamemodify('//?/UNC/server', ':h')) eq('//?/UNC/server/share', fnamemodify('//?/UNC/server/share', ':h')) eq('//?/UNC/server/share/', fnamemodify('//?/UNC/server/share/foo', ':h')) + + -- relative "./" and ".\" prefixes + eq('./path/to', fnamemodify('./path/to/hello.txt', ':h')) + eq('./path', fnamemodify('./path/to/hello.txt', ':h:h')) + eq('./path/to', fnamemodify([[.\path\to\hello.txt]], ':h')) end end) |