Skip to content
Snippets Groups Projects

fix: base url in header image

Merged Moritz Stückler requested to merge fix/base-url-in-header-image into main
1 file
+ 1
11
Compare changes
  • Side-by-side
  • Inline
+ 1
11
@@ -23,17 +23,7 @@ export const prefixWithBaseIfNotUrl = (
baseUrl?: string
): string => {
if (baseUrl) {
let pattern = new RegExp(
"^(https?:\\/\\/)?" + // protocol
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|" + // domain name
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
"(\\#[-a-z\\d_]*)?$",
"i"
); // fragment locator
const isExternalUrl = pattern.test(path);
const isExternalUrl = path.toLowerCase().startsWith("http");
return isExternalUrl ? path : baseUrl + path;
}
Loading