fix: Skip media entities with empty URI from OBJE without FILE#586
fix: Skip media entities with empty URI from OBJE without FILE#586isaacschepp wants to merge 23 commits intomainfrom
Conversation
OBJE records with empty or missing FILE values were creating media entities with empty URI fields. Now both convertMedia and convertEmbeddedMedia skip storage when URI is empty (no FILE and no BLOB data). Fixes #492
Deploying genealogix with
|
| Latest commit: |
775b410
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6e6db6cf.genealogix.pages.dev |
| Branch Preview URL: | https://fix-empty-media-uri.genealogix.pages.dev |
There was a problem hiding this comment.
Pull request overview
Fixes GEDCOM import behavior where OBJE records with missing/empty FILE values were producing invalid GLX media entities with an empty uri, by skipping such media entities during conversion.
Changes:
- Added guards in top-level and embedded OBJE conversion to skip media when
media.URI == "", with log messages (fix for #492). - Added import tests covering empty
FILEand missingFILEtag scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| go-glx/gedcom_media.go | Skips media entities that would end up with an empty URI during OBJE conversion. |
| go-glx/gedcom_import_test.go | Adds tests intended to ensure OBJE records without usable FILE data don’t create invalid media. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Deleted 5 stale Go module caches (~7 KiB each) that were causing the \ message. The caches were saved empty before \ was added, and were being hit on every run (key matched \ hash). Only the healthy 43.53 MiB cache remains. Next CI run should populate fresh caches for the current \ hash. |
- Delete MediaIDMap entry when skipping empty-URI OBJE to prevent dangling references from other records pointing to non-existent media - Replace weak loop-based test with direct assert.Empty on Media map
|
Both Copilot items addressed in 144dd5c:
|
What and why
GEDCOM OBJE records with empty or missing FILE values created media entities with empty
urifields. These are invalid entities that can't reference any actual media file.The fix
Added URI guards in both
convertMedia(top-level OBJE) andconvertEmbeddedMedia(inline OBJE). Whenmedia.URI == ""after processing, the entity is skipped with a log message instead of stored.OBJE with BLOB data are unaffected — the BLOB path populates URI before the guard is reached.
Related issues
Fixes #492
Testing
TestImportMedia_EmptyFileSkipped— OBJE with empty FILE valueTestImportMedia_NoFileTagSkipped— OBJE with no FILE tag at allBreaking changes
None. Previously, empty-URI media entities were created silently. Now they're skipped. No valid media data is lost.