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)