From ba27fe176b53197050672a59241a5cfeb5aebaeb Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 17 Mar 2026 22:08:21 -0400 Subject: [PATCH] fix(ftp): use nil entry ID so cache assigns unique IDs Problem: `M.list` returned entries as `{0, name, type, meta}`. `cache.store_entry` only assigns a fresh ID when `entry[FIELD_ID] == nil`; passing 0 caused every entry to be stored as ID 0, all overwriting each other. `get_entry_by_id(0)` then always returned the last-stored entry, breaking navigation (always opened the same file), rename (wrong entry matched), and create (wrong diff). Solution: change the placeholder from 0 to nil, matching how `cache.create_entry` itself builds entries. --- lua/oil/adapters/ftp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/oil/adapters/ftp.lua b/lua/oil/adapters/ftp.lua index 84f73ea..f27506c 100644 --- a/lua/oil/adapters/ftp.lua +++ b/lua/oil/adapters/ftp.lua @@ -407,7 +407,7 @@ M.list = function(url, column_defs, callback) name, entry_type, meta = parse_iis_list_line(line) end if name and entry_type and name ~= '.' and name ~= '..' then - table.insert(entries, { 0, name, entry_type, meta }) + table.insert(entries, { nil, name, entry_type, meta }) end end end