Skip to content

Commit

Permalink
fix: make resolveAssetUrl safe for base URL with or without trailing …
Browse files Browse the repository at this point in the history
…slash
  • Loading branch information
alexanderdavide committed Jan 13, 2024
1 parent dd445b3 commit a5c4f21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions layout-helper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { CSSProperties } from 'vue';

export function resolveAssetUrl(url: string) {
if (url.startsWith('/')) return import.meta.env.BASE_URL + url.slice(1);
return url;
const baseUrl = import.meta.env.BASE_URL;
if(!url.startsWith('/')) return url;
if(baseUrl.endsWith('/')) return baseUrl + url.slice(1);
return baseUrl + url;
}

export function handleBackground(background?: string, dim = false): CSSProperties {
Expand Down

0 comments on commit a5c4f21

Please sign in to comment.