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",
"version": "1.1.0",
"version": "1.1.1",
"description": "A uploader for uploading the Astro generated files through the S3 API.",
"keywords": ["Astro", "S3", "withastro", "opendal"],
"bugs": {

View File

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