fix(uri): change scheme pattern to not include the comma character (#16798)

(cherry picked from commit efbe306d2d)

Co-authored-by: Dmytro Meleshko <dmytro.meleshko@gmail.com>
This commit is contained in:
github-actions[bot] 2021-12-26 16:39:03 -05:00 committed by GitHub
parent 1cc63abf4a
commit 0e96f7d04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -74,8 +74,8 @@ local function uri_from_fname(path)
return table.concat(uri_parts) return table.concat(uri_parts)
end end
local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9+-.]*):.*' local URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):.*'
local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9+-.]*):[a-zA-Z]:.*' local WINDOWS_URI_SCHEME_PATTERN = '^([a-zA-Z]+[a-zA-Z0-9.+-]*):[a-zA-Z]:.*'
--- Get a URI from a bufnr --- Get a URI from a bufnr
---@param bufnr number ---@param bufnr number

View File

@ -155,6 +155,12 @@ describe('URI methods', function()
return pcall(vim.uri_to_fname, 'not_an_uri.txt') return pcall(vim.uri_to_fname, 'not_an_uri.txt')
]]) ]])
end) end)
it('uri_to_fname should not treat comma as a scheme character', function()
eq(false, exec_lua [[
return pcall(vim.uri_to_fname, 'foo,://bar')
]])
end)
end) end)
end) end)