From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common] rest handler: map path to methods: avoid returning misleading 'internal error'
Date: Mon, 19 Jan 2026 11:15:41 +0100 [thread overview]
Message-ID: <20260119101554.39139-1-f.ebner@proxmox.com> (raw)
When a path pointing to below a leaf endpoint is provided, for example
'/access/acl/foobar', then when reaching the leaf endpoint, there is
neither a regex nor subfolders to continue the lookup. This is fully
expected, but currently an 'internal error' message will be returned
and the only caller will log it to syslog. Returning undef instead
avoids the misleading error log while otherwise preserving the same
behavior as before. That is, failing the request with a clear error:
501 Method 'GET /access/acl/foobar' not implemented
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
src/PVE/RESTHandler.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm
index cc82fe8..0dfb54e 100644
--- a/src/PVE/RESTHandler.pm
+++ b/src/PVE/RESTHandler.pm
@@ -383,8 +383,8 @@ sub map_path_to_methods {
} elsif ($path_lookup->{folders}) {
$path_lookup = $path_lookup->{folders}->{$comp};
$$pathmatchref .= '/' . $comp if defined($pathmatchref);
- } else {
- die "internal error";
+ } else { # leaf endpoint
+ return undef;
}
return undef if !$path_lookup;
--
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:[~2026-01-19 10:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260119101554.39139-1-f.ebner@proxmox.com \
--to=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.