From e1848d2d5adae70b5c26998ca44d2443e844a60e Mon Sep 17 00:00:00 2001 From: "Qian Xu (Stanely)" Date: Mon, 18 Jan 2021 13:27:35 +0800 Subject: [PATCH 1/2] fix #515: use resolved path for moving file (fix underlying problem that source directory is not a full path that might cause a cross-device link error) --- src/nextra/move.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nextra/move.ts b/src/nextra/move.ts index 493aedbc..6010cc39 100644 --- a/src/nextra/move.ts +++ b/src/nextra/move.ts @@ -25,7 +25,9 @@ export interface MoveOptions { */ export async function move(source: string, destination: string, options: MoveOptions = {}): Promise { const overwrite = options.overwrite || false; - if (resolve(source) === resolve(destination)) return fsp.access(source); + source = resolve(source) + destination = resolve(destination) + if (source === destination) return fsp.access(source); const myStat = await fsp.lstat(source); if (myStat.isDirectory() && isSrcKid(source, destination)) { From 6ebcd3fac4c18b12574c9f271eb60866704e8609 Mon Sep 17 00:00:00 2001 From: "Qian Xu (Stanely)" Date: Mon, 18 Jan 2021 13:29:59 +0800 Subject: [PATCH 2/2] Update move.ts --- src/nextra/move.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nextra/move.ts b/src/nextra/move.ts index 6010cc39..0ad52bdc 100644 --- a/src/nextra/move.ts +++ b/src/nextra/move.ts @@ -25,8 +25,8 @@ export interface MoveOptions { */ export async function move(source: string, destination: string, options: MoveOptions = {}): Promise { const overwrite = options.overwrite || false; - source = resolve(source) - destination = resolve(destination) + source = resolve(source); + destination = resolve(destination); if (source === destination) return fsp.access(source); const myStat = await fsp.lstat(source);