Skip to content

Commit

Permalink
Templatize encoded portal urls in storymaps #1299
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTschudi committed Nov 20, 2023
1 parent e4d8311 commit 5ebf011
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/creator/src/helpers/add-content-to-solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ export function _templatizeOrgUrl(
return new Promise((resolve, reject) => {
// Get the org's URL
getPortal(null, destAuthentication).then(org => {
const orgUrl = "https://" + org.urlKey + "." + org.customBaseUrl;
let orgUrl = "https://" + org.urlKey + "." + org.customBaseUrl;
const templatizedOrgUrl = "{{portalBaseUrl}}";

// Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements
Expand All @@ -563,6 +563,19 @@ export function _templatizeOrgUrl(
templatizedOrgUrl
);
});

// Handle encoded URLs
orgUrl = orgUrl.replace("https://", "https%3A%2F%2F");

// Cycle through each of the items in the template and scan the `data` sections of each for replacements
templates.forEach((template: IItemTemplate) => {
globalStringReplace(
template.data,
new RegExp(orgUrl, "gi"),
templatizedOrgUrl
);
});

resolve(templates);
}, reject);
});
Expand Down

0 comments on commit 5ebf011

Please sign in to comment.