mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-11 01:10:11 +01:00
refactor spaceKey url pattern for custom domains
This commit is contained in:
parent
cf969adf37
commit
87b41a60e9
@ -19,19 +19,17 @@ function validSpaceUrl(spaceUrl = "") {
|
||||
return { valid: true, result: atlassianMatch };
|
||||
}
|
||||
|
||||
// Custom Confluence URL match
|
||||
const customPattern = new UrlPattern(
|
||||
"https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*"
|
||||
);
|
||||
const customMatch = customPattern.match(spaceUrl);
|
||||
let customMatch = null;
|
||||
[
|
||||
"https\\://(:subdomain.):domain.:tld/wiki/spaces/(:spaceKey)/*", // Custom Confluence space
|
||||
"https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*", // Custom Confluence space + Human-readable space tag.
|
||||
].forEach((matchPattern) => {
|
||||
if (!!customMatch) return;
|
||||
const pattern = new UrlPattern(matchPattern);
|
||||
customMatch = pattern.match(spaceUrl);
|
||||
});
|
||||
|
||||
// Custom "display" Confluence URL match
|
||||
const customDisplayPattern = new UrlPattern(
|
||||
"https\\://(:subdomain.):domain.:tld/display/(:spaceKey)/*"
|
||||
);
|
||||
const customDisplayMatch = customDisplayPattern.match(spaceUrl);
|
||||
|
||||
if (customMatch || customDisplayMatch) {
|
||||
if (customMatch) {
|
||||
customMatch.customDomain =
|
||||
(customMatch.subdomain ? `${customMatch.subdomain}.` : "") + //
|
||||
`${customMatch.domain}.${customMatch.tld}`;
|
||||
|
Loading…
Reference in New Issue
Block a user