Skip to content
Snippets Groups Projects
Commit 87b41a60 authored by timothycarambat's avatar timothycarambat
Browse files

refactor spaceKey url pattern for custom domains

parent cf969adf
No related branches found
No related tags found
No related merge requests found
...@@ -19,19 +19,17 @@ function validSpaceUrl(spaceUrl = "") { ...@@ -19,19 +19,17 @@ function validSpaceUrl(spaceUrl = "") {
return { valid: true, result: atlassianMatch }; return { valid: true, result: atlassianMatch };
} }
// Custom Confluence URL match let customMatch = null;
const customPattern = new UrlPattern( [
"https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*" "https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*", // Custom Confluence space
); "https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*", // Custom Confluence space + Human-readable space tag.
const customMatch = customPattern.match(spaceUrl); ].forEach((matchPattern) => {
if (!!customMatch) return;
// Custom "display" Confluence URL match const pattern = new UrlPattern(matchPattern);
const customDisplayPattern = new UrlPattern( customMatch = pattern.match(spaceUrl);
"https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*" });
);
const customDisplayMatch = customDisplayPattern.match(spaceUrl);
if (customMatch || customDisplayMatch) { if (customMatch) {
customMatch.customDomain = customMatch.customDomain =
(customMatch.subdomain ? `${customMatch.subdomain}.` : "") + // (customMatch.subdomain ? `${customMatch.subdomain}.` : "") + //
`${customMatch.domain}.${customMatch.tld}`; `${customMatch.domain}.${customMatch.tld}`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment