Skip to content

Commit 0dd5e57

Browse files
authored
Update file upload logic to only rename file when appropriate (#2270)
1 parent 0731597 commit 0dd5e57

File tree

1 file changed

+3
-1
lines changed
  • app/preprints/-components/submit/file/upload-file

1 file changed

+3
-1
lines changed

app/preprints/-components/submit/file/upload-file/component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ export default class PreprintUpload extends Component<PreprintUploadArgs> {
8989
@waitFor
9090
async success(_: any, __:any, file: FileModel): Promise<void> {
9191
if (this.args.isEdit) {
92-
await this.primaryFile?.rename(file.name);
92+
if (file.name !== this.primaryFile?.name) {
93+
await this.primaryFile?.rename(file.name);
94+
}
9395
} else {
9496
const primaryFile = await this.rootFolder!.files;
9597
this.args.manager.preprint.set('primaryFile', primaryFile.firstObject);

0 commit comments

Comments
 (0)