Skip to content

Commit

Permalink
🐛 Fix: fix processImagePath to detect remote path (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
toddLiao469469 committed Oct 13, 2023
1 parent 821245a commit 0b46086
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-radios-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kwchang0831/qwer': minor
---

fix processImagePath to detect remote path
6 changes: 6 additions & 0 deletions QWER/lib/processFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ export const processRmDir = (dir) => {
}
};

const isRemotePath = (path) => {
return path.startsWith('http://') || path.startsWith('https://');
};

export const processImagePath = (path, slug) => {
if (!path || !slug) return;

if (isRemotePath(path)) return path;

if (!isAbsolute(path)) {
path = join(slug, path);
}
Expand Down

0 comments on commit 0b46086

Please sign in to comment.