fix onedrive issue in enc

This commit is contained in:
fyears 2024-05-08 22:37:29 +08:00
parent e66b0c71c4
commit 2a3df8ab53
9 changed files with 38 additions and 1 deletions

View File

@ -16,4 +16,5 @@ export abstract class FakeFs {
abstract checkConnect(callbackFunc?: any): Promise<boolean>; abstract checkConnect(callbackFunc?: any): Promise<boolean>;
abstract getUserDisplayName(): Promise<string>; abstract getUserDisplayName(): Promise<string>;
abstract revokeAuth(): Promise<any>; abstract revokeAuth(): Promise<any>;
abstract allowEmptyFile(): boolean;
} }

View File

@ -736,4 +736,8 @@ export class FakeFsDropbox extends FakeFs {
return false; return false;
} }
} }
allowEmptyFile(): boolean {
return true;
}
} }

View File

@ -273,9 +273,13 @@ export class FakeFsEncrypt extends FakeFs {
return copyEntityAndCopyKeyEncSizeEnc(innerEntity); return copyEntityAndCopyKeyEncSizeEnc(innerEntity);
} else { } else {
const now = Date.now(); const now = Date.now();
let content = new ArrayBuffer(0);
if (!this.innerFs.allowEmptyFile()) {
content = new ArrayBuffer(1);
}
const innerEntity = await this.innerFs.writeFile( const innerEntity = await this.innerFs.writeFile(
keyEnc, keyEnc,
new ArrayBuffer(0), content,
mtime ?? now, mtime ?? now,
ctime ?? now ctime ?? now
); );
@ -554,4 +558,8 @@ export class FakeFsEncrypt extends FakeFs {
async revokeAuth(): Promise<any> { async revokeAuth(): Promise<any> {
return await this.innerFs.revokeAuth(); return await this.innerFs.revokeAuth();
} }
allowEmptyFile(): boolean {
return true;
}
} }

View File

@ -170,4 +170,8 @@ export class FakeFsLocal extends FakeFs {
async revokeAuth(): Promise<any> { async revokeAuth(): Promise<any> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
allowEmptyFile(): boolean {
return true;
}
} }

View File

@ -49,4 +49,8 @@ export class FakeFsMock extends FakeFs {
async revokeAuth(): Promise<any> { async revokeAuth(): Promise<any> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
allowEmptyFile(): boolean {
throw new Error("Method not implemented.");
}
} }

View File

@ -928,4 +928,8 @@ export class FakeFsOnedrive extends FakeFs {
async getRevokeAddr() { async getRevokeAddr() {
return "https://account.live.com/consent/Manage"; return "https://account.live.com/consent/Manage";
} }
allowEmptyFile(): boolean {
return false;
}
} }

View File

@ -817,4 +817,8 @@ export class FakeFsS3 extends FakeFs {
async revokeAuth() { async revokeAuth() {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
allowEmptyFile(): boolean {
return true;
}
} }

View File

@ -493,4 +493,8 @@ export class FakeFsWebdav extends FakeFs {
async revokeAuth() { async revokeAuth() {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
allowEmptyFile(): boolean {
return true;
}
} }

View File

@ -239,4 +239,8 @@ export class FakeFsWebdis extends FakeFs {
async revokeAuth(): Promise<any> { async revokeAuth(): Promise<any> {
throw new Error("Method not implemented."); throw new Error("Method not implemented.");
} }
allowEmptyFile(): boolean {
return true;
}
} }