From d21660e5be3b1b24257378659dbb59435d0b75f7 Mon Sep 17 00:00:00 2001 From: futa-ikeda Date: Tue, 25 Nov 2025 17:07:18 -0500 Subject: [PATCH] fix(preprints): Fix for preprint file upload bug --- .../store/preprint-stepper/preprint-stepper.state.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts index d63e44fad..f1c9bbeb8 100644 --- a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts @@ -223,9 +223,14 @@ export class PreprintStepperState { ctx.setState(patch({ preprintFile: patch({ isLoading: true }) })); - return this.fileService - .updateFileContent(action.file, uploadedFile.links.upload) - .pipe(switchMap(() => this.fileService.renameEntry(uploadedFile.links.upload, action.file.name, 'replace'))); + return this.fileService.updateFileContent(action.file, uploadedFile.links.upload).pipe( + switchMap(() => { + if (uploadedFile.name !== action.file.name) { + return this.fileService.renameEntry(uploadedFile.links.upload, action.file.name, 'replace'); + } + return EMPTY; + }) + ); } @Action(FetchPreprintPrimaryFile)