Skip to content

Commit

Permalink
fix: relative paths being handled as absolute ones
Browse files Browse the repository at this point in the history
The trim() method did not actually trim the
string but rather made it relative to the current PWD.
This new path also began with a '/' char,
making it being handled as an absolute path.
Everything should work as intended now
  • Loading branch information
FabulousCodingFox authored and shepherdjerred committed Jul 4, 2024
1 parent 448f3e1 commit bfd1174
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export function getFilePath({ dir, page }: { dir: string; page: string }) {
if (!fs.existsSync(`${dir}${page}`)) {
target = path.join(dir, page + ".html")
}

return trim(target);
return target;
}

export function getImagePath({ url, site }: { url: URL; site: URL | undefined }): string {
Expand Down Expand Up @@ -45,11 +45,3 @@ export function getImagePath({ url, site }: { url: URL; site: URL | undefined })

return target;
}

function trim(input: string): string {
// remove local filesystem pathname
input = input.replace(process.cwd(), "");
input = input.replace("/dist/", "dist/");

return input;
}

0 comments on commit bfd1174

Please sign in to comment.