Harden media-list None handling in FairEmail, SamsungNotes, gmailIMAPEmails#859
Merged
Conversation
…Emails check_in_media() returns None when its path does not resolve to a checked-in file (a matched directory, or a missing file). That None was being appended into media-typed list columns; lava_insert_sqlite_data json.dumps's a list cell, so it became e.g. ["ref", null]. The LAVA viewer parses the array, hits null, shows a broken-media marker and crashes (black screen) on hover. The HTML path (get_data_list_with_media) silently skips unresolved refs, so it only reproduced in LAVA. Same bug class fixed for teleguard in #858. For each artifact: capture the ref first and append only when truthy, and require os.path.isfile on the loose path match so a directory is never passed to check_in_media. Collapse a single resolved ref to a bare value (list only for genuine multi-attachment cells, '' when none resolve), mirroring teleguard. No change to which files are matched. FairEmail.py: Attachments and Content columns (also drops the stray 0 sentinel in the Attachments media cell). SamsungNotes.py: Media column. gmailIMAPEmails.py: Attachments column (received + sent paths).
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.
Hardens three more LAVA media columns against the same
None-in-a-media-list crash just fixed for Teleguard - Messages (#858).Root cause
check_in_media(path, name)returnsNonewhenpathdoes not resolve to a checked-in file in the current artifact'sfiles_found— e.g. the loose match landed on a directory, or the file is missing. ThatNonewas appended straight into a media-typed list column.lava_insert_sqlite_datajson.dumps's a list cell, so it serialized to e.g.["validref", null]; the LAVA viewer parses the array, hits thenull, shows a red broken-media marker and crashes (black screen) on hover. The HTML path (get_data_list_with_media) silently skips unresolved refs, so this only reproduced in LAVA.Fix (per artifact, mirroring #858)
Noneever lands in the media list.os.path.isfile(...)on the loose path match, so a directory is never passed tocheck_in_media.''when none resolve), so single-media cells render like every other artifact.Files
scripts/artifacts/FairEmail.py—('Attachments','media')and('Content','media')columns. Also replaces the stray0sentinel previously written into the Attachments media cell when a message had no attachments.scripts/artifacts/SamsungNotes.py—('Media','media')column.scripts/artifacts/gmailIMAPEmails.py—('Attachments','media')column (both the received.db_attand sent.attachmentmatch paths).Verification
py_compileclean on all three.-d C,R→ 10.00/10 (only the expectedE0401import-errors, ignored).PluginLoader()loads 492 plugins — identical tomain, no module dropped, no load warnings for the three modules.