mirror of
https://github.com/neovim/neovim.git
synced 2025-12-15 19:05:40 +00:00
fix(path): path_is_url returns false for "foo:/" #19797
Problem:
path_to_url() returns false for single-slash URIs ("foo:/" vs "foo://").
This is not compliant with the URI spec. https://url.spec.whatwg.org/#url-representation
LSP in particular allows single-slash URIs.
Solution:
Relax path_to_url() to accept single-slash URIs. This is not fully
compliant (only ":" is required by the spec), but it is hopefully good
enough without causing false-positives in typical text files.
ref https://url.spec.whatwg.org/#windows-drive-letter
ref https://github.com/neovim/neovim/pull/19773
ref https://github.com/neovim/neovim/pull/19773#issuecomment-1214763769
This commit is contained in:
@@ -640,6 +640,10 @@ describe('path.c', function()
|
||||
eq(2, path_with_url([[test-abc:\\xyz\foo\b3]]))
|
||||
eq(0, path_with_url([[-test://xyz/foo/b4]]))
|
||||
eq(0, path_with_url([[test-://xyz/foo/b5]]))
|
||||
eq(1, path_with_url([[test-C:/xyz/foo/b5]]))
|
||||
eq(1, path_with_url([[test-custom:/xyz/foo/b5]]))
|
||||
eq(0, path_with_url([[c:/xyz/foo/b5]]))
|
||||
eq(0, path_with_url([[C:/xyz/foo/b5]]))
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user