From d1a0943b3335b40a01cd56cabee99d14663e5aa9 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Mon, 8 Jul 2024 21:06:18 +0800 Subject: [PATCH] fix: add the override options. --- package.json | 2 +- src/index.ts | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index c326c81..d3e3c6e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.ts b/src/index.ts index f10cf5b..3273397 100644 --- a/src/index.ts +++ b/src/index.ts @@ -99,14 +99,11 @@ 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) { - await this.operator.delete(key); - return false; - } - - return true; + if ((contentLength !== null && contentLength !== BigInt(size)) || this.override) { + await this.operator.delete(key); + return false; } + return true; } return false;