Skip to content

Commit 50a75f6

Browse files
authored
fix: correct source and destination parameters in symlink operations (#1301)
Signed-off-by: Jeff MAURY <[email protected]>
1 parent 13b4fea commit 50a75f6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/hub/src/utils/symlink.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ describe("createSymlink", () => {
4040

4141
test("should copyfile", async () => {
4242
await createSymlink(dst, src);
43-
expect(fs.copyFile).toHaveBeenCalledWith(path.resolve(src), path.resolve(dst));
43+
expect(fs.copyFile).toHaveBeenCalledWith(path.resolve(dst), path.resolve(src));
4444
});
4545

4646
test("should rename file if new_blob is true", async () => {
4747
await createSymlink(dst, src, true);
48-
expect(fs.rename).toHaveBeenCalledWith(path.resolve(src), path.resolve(dst));
48+
expect(fs.rename).toHaveBeenCalledWith(path.resolve(dst), path.resolve(src));
4949
});
5050
});
5151

packages/hub/src/utils/symlink.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ export async function createSymlink(dst: string, src: string, new_blob?: boolean
5454
} catch (_e: unknown) {
5555
if (new_blob) {
5656
console.info(`Symlink not supported. Moving file from ${abs_src} to ${abs_dst}`);
57-
await fs.rename(abs_src, abs_dst);
57+
await fs.rename(abs_dst, abs_src);
5858
} else {
5959
console.info(`Symlink not supported. Copying file from ${abs_src} to ${abs_dst}`);
60-
await fs.copyFile(abs_src, abs_dst);
60+
await fs.copyFile(abs_dst, abs_src);
6161
}
6262
}
6363
}

0 commit comments

Comments
 (0)