Repository navigation
The Paprika importer keeps photos, archive copies, ratings, and nutrition - #97
Merged
Merged
Conversation
Paprika embeds each photo inside the .paprikarecipe JSON (photo_data, or photos[0].data); `photo` is only the embedded filename. The importer built a data URL out of the filename, so the magic-byte check rejected every picture and imports arrived imageless. The bytes are now used, with photo_url/image_url as a remote fallback, on the server and in the client copy; local mode turns the data URL into a real file via uploadImage instead of storing megabytes of base64 in the table. A Paprika archive can also hold several user-made copies of one recipe (same name or source URL, distinct entries). Batch imports now dedup against the library the user had before the import, not against rows written earlier in the same batch — on the server (/import-zip/commit and /import) and in local mode (importRecipe and commitRecipeZip).
thebigjoe1
added a commit
that referenced
this pull request
Nov 13, 2026
…hone ratings and photo checks, small scan thumbnails (#97)
Contributor
|
Thanks! Merged, with a few changes on top: a recipe that's in the archive twice under the same name still imports once (copies and recipes from the same page import), ratings come through in the Android app too, and the bulk scan sends small thumbnails rather than whole photos. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Importing a
.paprikarecipesarchive lost every photo, treated copies inside the same archive as duplicates, and dropped two fields. Four fixes, all verified against a real 275-recipe export.What was broken
_importPaprikabuilt the image data URL fromr.photo, which holds a filename (photo_sJxG3k.jpg), not base64. Every embedded photo became a garbage data URL that the image localizer rejected — one warning per recipe, andimg_urlended up null. The actual bytes live inphoto_data(orphotos[0].dataon exports that use the list form).ratingfield was never mapped.nutritional_infowas dropped. Present in the export, read by nothing.What changed
_paprikaImgUrl(r)in both importers (server and client):photo_data || photos[0].dataas a data URL;photo_url || image_urlas a remote fallback._findImportDuplicate/_saveImportedRecipetake an optionalexcludeIdsset. The import-zip commit loop, the bulk/importPaprika path, and both local-mode loops track the rows created in this batch and exclude them, so copies inside one archive land while cross-run dedup behaves exactly as before.rating: r.rating > 0 ? r.rating : nullin both importers and the local-mode payload._paprikaNotes(r)appends thenutritional_infotext to notes under aNutrition (from Paprika):heading.Local mode:
_localizeImportedImagedecodes data URLs and stores them through the normal upload path (Capacitor Filesystem) rather than leaving base64 in the payload;commitRecipeZipalso clearsimgUrlwhen "import images" is offVerification
A 275-recipe export, before & after:
The 240 stored images match the upload directory, and re-importing the same archive with skip-duplicates still skips all 275 — dedup across runs is unchanged.
Tests
New
scripts/paprika-import.test.js(11 tests): functional in-memory zip-import coverage for each image source, the rating mapping, and the nutrition append, plus source assertions for the client-side copy and theexcludeIdsthreading. Full suite: 1188 passing.