From: "Max R. Carrara" <m.carrara@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v1] ui: remote wizard: fix "invalid uri character" when adding PBS remote
Date: Wed, 3 Dec 2025 20:17:11 +0100 [thread overview]
Message-ID: <20251203191713.942001-1-m.carrara@proxmox.com> (raw)
... by normalizing the hostname in the form context directly when the
user clicks on "Next" in the remote addition wizard.
This is necessary because the wizard takes the values for submission
directly from its form context.
This is somewhat easy to run into, e.g. if one copy-pastes the URL of
the PBS remote to add from another browser tab.
Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
---
Note: I'm not sure if there's a more elegant way to do this; if there
is, please let me know!
ui/src/remotes/wizard_page_connect.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/ui/src/remotes/wizard_page_connect.rs b/ui/src/remotes/wizard_page_connect.rs
index 789c522..fb04f60 100644
--- a/ui/src/remotes/wizard_page_connect.rs
+++ b/ui/src/remotes/wizard_page_connect.rs
@@ -45,7 +45,7 @@ pub struct ConnectParams {
}
async fn connect(form_ctx: FormContext, remote_type: RemoteType) -> Result<TlsProbeOutcome, Error> {
- let hostname = normalize_hostname(form_ctx.read().get_field_text("hostname"));
+ let hostname = form_ctx.read().get_field_text("hostname");
let fingerprint = get_fingerprint(&form_ctx);
let pdm_client = crate::pdm_client();
match remote_type {
@@ -170,6 +170,14 @@ impl Component for PdmWizardPageConnect {
self.loading = true;
props.info.page_lock(true);
+ let form_ctx = props.info.form_ctx.clone();
+
+ let mut guard = form_ctx.write();
+ let hostname = guard.get_field_text("hostname");
+ let new_hostname = normalize_hostname(hostname);
+ guard.set_field_value("hostname", new_hostname.into());
+ drop(guard);
+
self.scan_guard = Some(AsyncAbortGuard::spawn({
let link = ctx.link().clone();
let form_ctx = props.info.form_ctx.clone();
@@ -270,7 +278,7 @@ fn call_on_connect_change(props: &WizardPageConnect, certificate_info: Option<Ce
if let Some(on_connect_change) = &props.on_connect_change {
let fingerprint = get_fingerprint(&props.info.form_ctx);
on_connect_change.emit(Some(ConnectParams {
- hostname: normalize_hostname(props.info.form_ctx.read().get_field_text("hostname")),
+ hostname: props.info.form_ctx.read().get_field_text("hostname"),
fingerprint: certificate_info
.and_then(|cert| cert.fingerprint)
.or(fingerprint),
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
reply other threads:[~2025-12-03 19: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=20251203191713.942001-1-m.carrara@proxmox.com \
--to=m.carrara@proxmox.com \
--cc=pdm-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.