Normalize pasted Zendesk subdomain URLs
Pasting a full Zendesk URL with a path or query (e.g. acme.zendesk.com/agent?x=1) left the trailing segments in place because the .zendesk.com suffix no longer matched at the end, producing an invalid site value rejected by the backend. Drop everything from the first path/query/fragment separator before stripping the suffix. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -177,7 +177,9 @@ function hasRequiredExtraSettings(
|
||||
function cleanZendeskSubdomain(raw: string): string {
|
||||
let value = raw.trim();
|
||||
value = value.replace(/^https?:\/\//i, "");
|
||||
value = value.replace(/\/+$/, "");
|
||||
// Drop any path, query, or fragment from a pasted URL/host so only the
|
||||
// host label survives (e.g. "acme.zendesk.com/agent?x=1" -> "acme").
|
||||
value = value.replace(/[/?#].*$/, "");
|
||||
value = value.replace(/\.zendesk\.com$/i, "");
|
||||
return value.trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user