Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 68eb7e2

Browse files
committed
Normalize paths
1 parent bfcd2f1 commit 68eb7e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/middlewares/localFs/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ export function localFsMiddleware({ repoPath, logger }: FsOptions) {
8282
const files = await listRepoFiles(repoPath, mediaFolder, "", 1);
8383
res.json(
8484
files.map((file) => ({
85-
path: file.replace('\\', '/'),
86-
url: path.join(repoPath, file).replace('\\', '/')
85+
path: file.replace(/\\\\/g, '/'),
86+
url: path.join(repoPath, file).replace(/\\\\/g, '/')
8787
}))
8888
);
8989
break;

src/middlewares/localGit/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ export function localGitMiddleware({ repoPath, logger }: GitOptions) {
165165
const mediaFiles = await runOnBranch(git, branch, async () => {
166166
const files = await listRepoFiles(repoPath, mediaFolder, "", 1);
167167
return files.map((file) => ({
168-
path: file.replace('\\', '/'),
169-
url: path.join(repoPath, file).replace('\\', '/'),
168+
path: file.replace(/\\\\/g, '/'),
169+
url: path.join(repoPath, file).replace(/\\\\/g, '/'),
170170
}));
171171
});
172172
res.json(mediaFiles);

0 commit comments

Comments
 (0)