mirror of
https://github.com/neovim/neovim
synced 2025-07-17 01:31:48 +00:00
fix(filetype): handle .in files with no filename (#30487)
Problem:
fnamemodify with the :r flag will not strip extensions if the filename
starts with a ".". This means that files named ".in" could cause an
infinite loop.
Solution:
Add early return if the filename was not changed
(cherry picked from commit 032e024f8a
)
This commit is contained in:
committed by
github-actions[bot]
parent
b380a8fe21
commit
3a23149cfc
@ -144,6 +144,9 @@ end
|
|||||||
|
|
||||||
local function detect_noext(path, bufnr)
|
local function detect_noext(path, bufnr)
|
||||||
local root = fn.fnamemodify(path, ':r')
|
local root = fn.fnamemodify(path, ':r')
|
||||||
|
if root == path then
|
||||||
|
return
|
||||||
|
end
|
||||||
return M.match({ buf = bufnr, filename = root })
|
return M.match({ buf = bufnr, filename = root })
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1258,8 +1261,7 @@ local extension = {
|
|||||||
['dpkg-new'] = detect_noext,
|
['dpkg-new'] = detect_noext,
|
||||||
['in'] = function(path, bufnr)
|
['in'] = function(path, bufnr)
|
||||||
if vim.fs.basename(path) ~= 'configure.in' then
|
if vim.fs.basename(path) ~= 'configure.in' then
|
||||||
local root = fn.fnamemodify(path, ':r')
|
return detect_noext(path, bufnr)
|
||||||
return M.match({ buf = bufnr, filename = root })
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
new = detect_noext,
|
new = detect_noext,
|
||||||
|
Reference in New Issue
Block a user