public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Proxmox Datacenter Manager development discussion"
	<pdm-devel@lists.proxmox.com>,
	"Thomas Lamprecht" <t.lamprecht@proxmox.com>
Subject: Re: [pdm-devel] [RFC PATCH proxmox] pve api types: percent encode string params in url
Date: Mon, 01 Dec 2025 09:55:15 +0100	[thread overview]
Message-ID: <DEMR5UQADTG5.2LASL9CZ9V9CZ@proxmox.com> (raw)
In-Reply-To: <20251128130124.2738745-1-d.csapak@proxmox.com>

On Fri Nov 28, 2025 at 1:59 PM CET, Dominik Csapak wrote:
> when we generate an url for the pve api from something like
>
> "/some/{foo}/thing/{bar}"
>
> then the url we generate will be wrapped in a `format!` and the
> variables `foo` and `bar` will be inserted into the url.
>
> Sometimes, these parameters can contain invalid characters for a url and
> we have to percent encode them.
>
> To do that, we convert the url to one with unnamed parameters and add
> them with percent encoding.
>
> The order of the url_params is the same as in the url, so we don't
> have to to a lookup or similar, simply iterating over that is enough.
>
> This fixes an issue with UPIDs that contain the character '>'.
> (e.g. move disk from one vm to another).
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> sending as RFC, because there is a (not so generic) alternative:
> we could simply percent encode the upid ourselves in pdm, whenever
> we call the pve api.

I think handling encoding at this level as implemented in this patch is
exactly right.

>
> but since this wasn't too hard to do and everything seems to work
> in my (albeit short) tests, I wanted to send it and gather feedback.
>
>  pve-api-types/generator-lib/Schema2Rust.pm | 29 +++++++++++++++++++++-
>  pve-api-types/src/client/code.rs           |  2 ++
>  2 files changed, 30 insertions(+), 1 deletion(-)
>

Couldn't find anything that looked off. Everything seems to work fine
after applying this patch, refreshing the bindings and building PDM with
them. Verified in the browser console that non-alphanumeric characters
are indeed percent-encoded. Also spot-checked the diff of the generated code,
everything that I saw looked reasonable.

Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Lukas Wagner <l.wagner@proxmox.com>


_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-12-01  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-28 12:59 Dominik Csapak
2025-12-01  8:55 ` Lukas Wagner [this message]
2025-12-01 16:33 ` [pdm-devel] applied: " Thomas Lamprecht

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=DEMR5UQADTG5.2LASL9CZ9V9CZ@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=t.lamprecht@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