* [pdm-devel] [PATCH datacenter-manager v1] ui: remote wizard: fix "invalid uri character" when adding PBS remote
@ 2025-12-03 19:17 Max R. Carrara
2025-12-09 16:43 ` [pdm-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Max R. Carrara @ 2025-12-03 19:17 UTC (permalink / raw)
To: pdm-devel
... 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pdm-devel] applied: [PATCH datacenter-manager v1] ui: remote wizard: fix "invalid uri character" when adding PBS remote
2025-12-03 19:17 [pdm-devel] [PATCH datacenter-manager v1] ui: remote wizard: fix "invalid uri character" when adding PBS remote Max R. Carrara
@ 2025-12-09 16:43 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-12-09 16:43 UTC (permalink / raw)
To: pdm-devel, Max R. Carrara
On Wed, 03 Dec 2025 20:17:11 +0100, Max R. Carrara wrote:
> ... 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.
>
> [...]
Applied, thanks!
btw. might be also nice to extend normalize_hostname such that it also
removes hash anchor parts from the URL, as those are also often there if one
copies the full URL from the address bar of a PBS or PVE's web UI browser
tab.
FWIW, there is a web APIs to pare an URL [0], so it might be sensible to use
that API if the URL starts with `https?://` and get the host (hostname +
port) from there rather than continuing to heuristically strip away parts.
[0]: https://developer.mozilla.org/en-US/docs/Web/API/URL/parse_static
[1/1] ui: remote wizard: fix "invalid uri character" when adding PBS remote
commit: ca5a7957af2be8110d4a1052a60e10606f22e498
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-09 17:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03 19:17 [pdm-devel] [PATCH datacenter-manager v1] ui: remote wizard: fix "invalid uri character" when adding PBS remote Max R. Carrara
2025-12-09 16:43 ` [pdm-devel] applied: " Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox