fix local storage copy function (#1442)
This commit is contained in:
parent
b97eb85d05
commit
97a7701f5d
1 changed files with 4 additions and 1 deletions
|
|
@ -40,8 +40,11 @@ export class LocalDriver implements StorageDriver {
|
||||||
|
|
||||||
async copy(fromFilePath: string, toFilePath: string): Promise<void> {
|
async copy(fromFilePath: string, toFilePath: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
const fromFullPath = this._fullPath(fromFilePath);
|
||||||
|
const toFullPath = this._fullPath(toFilePath);
|
||||||
|
|
||||||
if (await this.exists(fromFilePath)) {
|
if (await this.exists(fromFilePath)) {
|
||||||
await fs.copy(fromFilePath, toFilePath);
|
await fs.copy(fromFullPath, toFullPath);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(`Failed to copy file: ${(err as Error).message}`);
|
throw new Error(`Failed to copy file: ${(err as Error).message}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue