fix: add the override options.
This commit is contained in:
parent
c01279c4e3
commit
d1a0943b33
@ -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": {
|
||||||
|
@ -99,15 +99,12 @@ 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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user