Fixes two xImage background-task reliability issues found during public-beta QA:
Nested xImage paths break image embedding. Object keys encode nested paths with extra slash segments, for example project/db/items/doc1/meta/image/image.png, but embed_image_task() unpacked exactly six slash-separated values.
If retrieve_from_minio() fails, the exception handler writes public_url before it has been assigned, so the task raises UnboundLocalError instead of marking the field as failed.
Changes
Add parse_image_object_key() to preserve nested object paths as dot-notated EmbJSON paths.
Generate public_url before the MinIO retrieval try block so failure handling can still write a useful failed status payload.
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
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.
Summary
Fixes two xImage background-task reliability issues found during public-beta QA:
Changes
Validation
Nested object-key parser check:
proj/db/items/doc1/image/image.png => ('proj', 'db', 'items', 'doc1', 'image') proj/db/items/doc1/meta/image/image.png => ('proj', 'db', 'items', 'doc1', 'meta.image') proj/db/items/doc1/items/0/image/image.png => ('proj', 'db', 'items', 'doc1', 'items.0.image') PASSFailure-handler check with MinIO retrieval stubbed to fail:
[(({'_id': 'doc1'}, {'$set': {'image.xImage.status': 'failed', 'image.xImage.data': 'http://minio/proj/db/items/doc1/image/image.png'}}), {})] PASSAlso ran: