I ran into this when I accidentally went to the path /pve-docs/api-viewer
instead of /pve-docs/api-viewer/index.html, where I got this error:

`unable to detect content type at /usr/share/perl5/PVE/APIServer/AnyEvent.pm 
line 499.`

Which IMO was not very telling of the underlying mistake I had made.
This patch aims to improve this error message by checking if the
queried file is a directory and returning a more descriptive
message to the user.

I'm not sure (since I'm not too familiar with this codebase) if this
breaks any existing functionality I may have missed or was intended
behaviour, though I didn't find anything that would suggest this.

See also: https://perldoc.perl.org/IO::File#NOTE

Nicolas Frey (2):
  apiserver: fix typo
  apiserver: check if file is directory before opening

 src/PVE/APIServer/AnyEvent.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
2.47.3


_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to