public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Nicolas Frey <n.frey@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH 0/2] improve error message when accessing a directory
Date: Wed, 15 Oct 2025 10:03:28 +0200	[thread overview]
Message-ID: <20251015080330.45927-1-n.frey@proxmox.com> (raw)

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
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-10-15  8:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  8:03 Nicolas Frey [this message]
2025-10-15  8:03 ` [pve-devel] [PATCH 1/2] apiserver: fix typo Nicolas Frey
2025-10-15  8:03 ` [pve-devel] [PATCH 2/2] apiserver: check if file is directory before opening Nicolas Frey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251015080330.45927-1-n.frey@proxmox.com \
    --to=n.frey@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal