Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and mealie will automatically import the relevant data or add a family recipe with the UI editor
Fix file not found error with individual recipe export. (#3095 )
Add a suitable test.
Split temporary_zip_path into temporary_zip_path and unlinking_temporary_zip_path.
What type of PR is this?
(REQUIRED)
bug
What this PR does / why we need it:
(REQUIRED)
This PR fixes the issue that was preventing the recipe download and the /api/recipes/{slug}/exports/zip endpoint more generally from working. As described in #3095, it would fail with a file not found. This was caused by the file being deleted before the Response read the file from the filesystem.
Which issue(s) this PR fixes:
(REQUIRED)
Fixes #3095
Special notes for your reviewer:
(fill-in or delete this section)
I created a version of temporary_zip_path that doesn't unlink when the view completes and added background task to the Response to clean up the file that is run after the Response is delivered to the client.
Renamed the original temporary_zip_path to unlinking_temporary_zip_file and updated references to point to the new name. This seemed like clearer naming given the changes.
Testing
Manually tested and ran the test suite.
Added test_get_recipe_as_zip that failed with the error described in #3095 before the fix, and succeeded afterwards.
Verified the file was deleted after download.
Manually checked the endpoints potentially impacted by the dependency name change.
temporary_zip_path
intotemporary_zip_path
andunlinking_temporary_zip_path
.What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
This PR fixes the issue that was preventing the recipe download and the
/api/recipes/{slug}/exports/zip
endpoint more generally from working. As described in #3095, it would fail with a file not found. This was caused by the file being deleted before the Response read the file from the filesystem.Which issue(s) this PR fixes:
(REQUIRED)
Fixes #3095
Special notes for your reviewer:
(fill-in or delete this section)
I created a version of
temporary_zip_path
that doesn't unlink when the view completes and added background task to the Response to clean up the file that is run after the Response is delivered to the client.Renamed the original
temporary_zip_path
tounlinking_temporary_zip_file
and updated references to point to the new name. This seemed like clearer naming given the changes.Testing
test_get_recipe_as_zip
that failed with the error described in #3095 before the fix, and succeeded afterwards.