Skip to content

fix: sanitize_path_component false positive on consecutive dots #226

Description

@deucebucket

Bug

sanitize_path_component() in path_safety.py (~line 286) uses '..' in name which is a substring check. This blocks legitimate book titles containing consecutive dots:

  • "What If..?"
  • "Mr.. Smith"
  • "Vol. 1... The Beginning"

The intent is to block directory traversal (../) but the implementation catches innocent names.

Fix

Replace the substring check with a proper path component check:

# Instead of: '..' in name
# Use: any(part == '..' for part in name.split('/'))
# Or regex: re.search(r'(^|[\\/])\.\.($|[\\/])', name)

Severity

Low — causes some books to never get rename proposals. No data loss but missed identifications.

Found via code audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions