From 4fb19b3b59e8e7226e053af986eaafcf6affea98 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Fri, 16 Aug 2024 20:11:26 -0400 Subject: [PATCH] fix uploading dups --- .trunk/trunk.yaml | 10 +++++----- backend/endpoints/rom.py | 2 +- .../src/components/common/Game/Dialog/UploadRom.vue | 8 ++++---- frontend/src/components/common/UploadInProgress.vue | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 0f939ce01..ff49302e9 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -2,7 +2,7 @@ # To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml version: 0.1 cli: - version: 1.22.2 + version: 1.22.3 # Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) plugins: sources: @@ -19,24 +19,24 @@ runtimes: lint: enabled: - markdownlint@0.41.0 - - eslint@9.8.0 + - eslint@9.9.0 - actionlint@1.7.1 - bandit@1.7.9 - black@24.8.0 - - checkov@3.2.219 + - checkov@3.2.228 - git-diff-check - isort@5.13.2 - mypy@1.11.1 - osv-scanner@1.8.3 - oxipng@9.1.2 - prettier@3.3.3 - - ruff@0.5.7 + - ruff@0.6.0 - shellcheck@0.10.0 - shfmt@3.6.0 - svgo@3.3.2 - taplo@0.9.3 - trivy@0.54.1 - - trufflehog@3.81.7 + - trufflehog@3.81.9 - yamllint@1.35.1 ignore: - linters: [ALL] diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index af5a10cc1..b40e5f6f5 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -81,7 +81,7 @@ async def add_roms( skipped_files = [] for file in files: - if fs_rom_handler.file_exists(roms_path, file.filename): + if bool(os.path.exists(f"{roms_path}/{file.filename}")): skipped_files.append(file.filename) continue diff --git a/frontend/src/components/common/Game/Dialog/UploadRom.vue b/frontend/src/components/common/Game/Dialog/UploadRom.vue index 052711e8d..084962250 100644 --- a/frontend/src/components/common/Game/Dialog/UploadRom.vue +++ b/frontend/src/components/common/Game/Dialog/UploadRom.vue @@ -102,6 +102,8 @@ async function uploadRoms() { platformId: platformId, }) .then(({ data }) => { + uploadStore.clear(); + const { uploaded_files, skipped_files } = data; if (uploaded_files.length == 0) { @@ -109,7 +111,7 @@ async function uploadRoms() { msg: `All files skipped, nothing to upload.`, icon: "mdi-close-circle", color: "orange", - timeout: 2000, + timeout: 5000, }); } @@ -117,11 +119,9 @@ async function uploadRoms() { msg: `${uploaded_files.length} files uploaded successfully (and ${skipped_files.length} skipped). Starting scan...`, icon: "mdi-check-bold", color: "green", - timeout: 2000, + timeout: 3000, }); - uploadStore.clear(); - if (!socket.connected) socket.connect(); setTimeout(() => { socket.emit("scan", { diff --git a/frontend/src/components/common/UploadInProgress.vue b/frontend/src/components/common/UploadInProgress.vue index 32fea7ac1..7bc541f62 100644 --- a/frontend/src/components/common/UploadInProgress.vue +++ b/frontend/src/components/common/UploadInProgress.vue @@ -37,7 +37,7 @@ watch(romsList, (newList) => { :color="rom.finished ? `green` : `white`" class="mx-2" /> - {{ rom.filename }}... + {{ rom.filename }}