From de64c3c53f268cd8e3ad9d883a4ec7f614ffbafe Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Fri, 24 May 2024 22:41:43 +0800 Subject: [PATCH] fix condition for partial update --- src/fsWebdav.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/fsWebdav.ts b/src/fsWebdav.ts index 0b1f6e5..8b856b2 100644 --- a/src/fsWebdav.ts +++ b/src/fsWebdav.ts @@ -549,7 +549,19 @@ export class FakeFsWebdav extends FakeFs { ); } - // larger than 10 MB, try to upload by chunks + // larger than 10 MB + if (!this.isNextcloud && !this.supportNativePartial) { + // give up and upload by whole, and directly return + return await this._writeFileFromRootFull( + key, + content, + mtime, + ctime, + origKey + ); + } + + // try to upload by chunks try { if (this.isNextcloud) { return await this._writeFileFromRootNextcloud( @@ -568,10 +580,10 @@ export class FakeFsWebdav extends FakeFs { origKey ); } - throw Error(`no partial upload / update`); + throw Error(`Error: partial upload / update method is not implemented??`); } catch (e) { console.error( - `we fail to write file partially, so downgrade to full and ignore the error:` + `we fail to write file partially for nextcloud or apache or sabre/dav, stop!` ); console.error(e); throw e;