Browse plugin needs an update (maybe)

Hello,

the least we can say is that I am not a github expert; also, I allow myself to make the following suggestion here.

In my eyes, the function `“isSymlinkTargetDir()”
of “browse.go” has not yet been updated on the official caddy github at
‘caddyserver/caddy/caddyhttp/browse.go’.

I have found what I think is a more or less valid version in :


which was committed and verified 2 years ago.

I hope I do not make mistakes; if not, I apologize.
Hope to help.

I believe it (or equivalent) made it in with https://github.com/caddyserver/caddy/pull/1667

Thanks for the reply.

I have seen the ‘1667’ commit : well done for the template.

I believed that this line :
target, err := config.Fs.Root.Open(path.Join(urlPath, f.Name()))
pointed to the link itself, not to the file or dir pointed to. ==> I made a mistake !

In reality, you give a try to the symlink trying to open it inside the jailed FileSystem
(but the linked file or dir could be located outside ?).

Using “os.Readlink(f.Name())” and “…os.Lstat(target)” should be another way,
Less safe ? Faster ? Maybe not.

Thank you very much ; my excuse: it’s not so simple.