Skip to content

context: resolve files whose names contain glob metacharacters (e.g. IMG_0347[1].jpg)#1620

Merged
JamesHabben merged 1 commit into
abrignoni:mainfrom
OneSixForensics:fix/resolve-glob-metachar-filenames
Jun 26, 2026
Merged

context: resolve files whose names contain glob metacharacters (e.g. IMG_0347[1].jpg)#1620
JamesHabben merged 1 commit into
abrignoni:mainfrom
OneSixForensics:fix/resolve-glob-metachar-filenames

Conversation

@OneSixForensics

Copy link
Copy Markdown

Summary

Context.get_source_file_path() silently fails to resolve any file whose name contains a glob metacharacter — [, ], *, or ?. These are common in real device data (e.g. IMG_0347[1].jpg, [clips4sale.com]clip.mp4), so affected files are dropped from artifacts and never linked/rendered.

Root cause

When multiple candidates share a basename, the resolver disambiguates with Path(candidate).match(partial_path). Path.match treats the argument as a glob pattern, so metacharacters in a real filename are interpreted as wildcards and the match fails — the file resolves to nothing.

for candidate in candidate_paths:
    if Path(candidate).match(partial_path):   # partial_path used as a glob
        return candidate
return None

Fix

  • Single-candidate shortcut: when the basename maps to exactly one path, return it directly — no pattern match needed (the common case).
  • Exact-suffix fallback: keep the existing Path.match for back-compat, then fall back to a literal normalized path-suffix comparison, which resolves any filename regardless of metacharacters.

Behavior is unchanged for all currently-working filenames; it only adds resolution for names that previously failed.

Context

Same bug and fix as abrignoni/RLEAPP#284 (root-cause discussion in abrignoni/RLEAPP#286). @JamesHabben confirmed it reproduces and the fix works in iLEAPP. In RLEAPP it was validated against a real ~32 GB return (17,214 device-backup files, many with bracketed names — all now resolve).

get_source_file_path() disambiguates same-basename candidates with
Path(candidate).match(partial_path). Path.match treats the argument as a glob,
so real filenames containing [, ], * or ? (e.g. IMG_0347[1].jpg) are read as
wildcards and never resolve, silently dropping the file.

Add a single-candidate shortcut (the common, unambiguous case) and, for the
multi-candidate case, fall back to an exact normalized path-suffix comparison
after the existing Path.match. Backward compatible; only adds resolution for
names that previously failed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@OneSixForensics OneSixForensics force-pushed the fix/resolve-glob-metachar-filenames branch from 8044c92 to c002813 Compare June 26, 2026 02:22
@JamesHabben JamesHabben merged commit b72274b into abrignoni:main Jun 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants