Skip to content

🐛 Addressed the issue where files in the uploads folder couldn't be deleted in case of an error.#521

Closed
varadekd wants to merge 1 commit intoTryGhost:mainfrom
varadekd:main
Closed

🐛 Addressed the issue where files in the uploads folder couldn't be deleted in case of an error.#521
varadekd wants to merge 1 commit intoTryGhost:mainfrom
varadekd:main

Conversation

@varadekd
Copy link

Closes #519

  • In the scenario where a user uploaded corrupted files and attempted to scan them using gscan, an error occurred.
  • Previously, in this scenario, we failed to delete the uploaded file stored locally under the uploads folder.
  • Issue found: The identified bug was that we were only deleting the file when the promise was successfully resolved, and in the case of an error, we were simply moving to the next middleware.
  • Issue fixed: To resolve this issue, a finally block has been added to ensure that uploaded files are deleted in any case.

…eleted in case of an error.

Closes TryGhost#519

- In the scenario where a user uploaded corrupted files and attempted to scan them using gscan, an error occurred.
- Previously, in this scenario, we failed to delete the uploaded file stored locally under the uploads folder.
- Issue found: The identified bug was that we were only deleting the file when the promise was successfully resolved, and in the case of an error, we were simply moving to the next middleware.
- Issue fixed: To resolve this issue, a finally block has been added to ensure that uploaded files are deleted in any case.
@JohnONolan
Copy link
Member

Superseded by #686, which fixes the cleanup bug while ensuring next() is called exactly once.

@JohnONolan JohnONolan closed this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upload files are not getting deleted.

2 participants