fix: add the override options.

This commit is contained in:
Yufan Sheng 2024-07-08 21:06:18 +08:00
parent c01279c4e3
commit d1a0943b33
Signed by: syhily
GPG Key ID: DEB186763C308C31
2 changed files with 5 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "astro-uploader", "name": "astro-uploader",
"version": "1.1.0", "version": "1.1.1",
"description": "A uploader for uploading the Astro generated files through the S3 API.", "description": "A uploader for uploading the Astro generated files through the S3 API.",
"keywords": ["Astro", "S3", "withastro", "opendal"], "keywords": ["Astro", "S3", "withastro", "opendal"],
"bugs": { "bugs": {

View File

@ -99,14 +99,11 @@ class Uploader {
const exist = await this.operator.isExist(key); const exist = await this.operator.isExist(key);
if (exist) { if (exist) {
const { contentLength } = await this.operator.stat(key); const { contentLength } = await this.operator.stat(key);
if (contentLength !== null && contentLength !== BigInt(size)) { if ((contentLength !== null && contentLength !== BigInt(size)) || this.override) {
if (this.override) { await this.operator.delete(key);
await this.operator.delete(key); return false;
return false;
}
return true;
} }
return true;
} }
return false; return false;