Skip to content

Commit

Permalink
Update vite-server.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickJS authored May 16, 2024
1 parent d93a914 commit a8d17f0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/qwik/src/optimizer/src/plugins/vite-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ function getOrigin(req: IncomingMessage) {
}

function validateAndMerge(base: string, url: string) {
if (!base && !url.startsWith('/')) {
// if base is empty and url doesn't start with '/', it's safe to just return the url
if (!base || base === '/') {
// if base is empty or '/' and url it's safe to just return the url
return url;
} else if (!base && url.startsWith('/')) {
// if base is empty and url does start with '/', remove the starting '/' from url
return url.slice(1);
} else if (base && !base.endsWith('/') && !url.startsWith('/')) {
// if base doesn't end with '/' and url doesn't start with '/', add a '/' in between
base += '/';
Expand Down

0 comments on commit a8d17f0

Please sign in to comment.