fix: always enter directory entries as a directory

This commit is contained in:
Steven Arcangeli 2023-03-18 00:07:38 -07:00
parent 9814c8b3f1
commit 0d5db08015

View file

@ -394,15 +394,15 @@ M.select = function(opts)
local scheme, dir = util.parse_url(bufname) local scheme, dir = util.parse_url(bufname)
local child = dir .. entry.name local child = dir .. entry.name
local url = scheme .. child local url = scheme .. child
if local is_directory = entry.type == "directory"
entry.type == "directory"
or ( or (
entry.type == "link" entry.type == "link"
and entry.meta and entry.meta
and entry.meta.link_stat and entry.meta.link_stat
and entry.meta.link_stat.type == "directory" and entry.meta.link_stat.type == "directory"
) )
then if is_directory then
url = url .. "/"
-- If this is a new directory BUT we think we already have an entry with this name, disallow -- If this is a new directory BUT we think we already have an entry with this name, disallow
-- entry. This prevents the case of MOVE /foo -> /bar + CREATE /foo. -- entry. This prevents the case of MOVE /foo -> /bar + CREATE /foo.
-- If you enter the new /foo, it will show the contents of the old /foo. -- If you enter the new /foo, it will show the contents of the old /foo.