Skip to content

Clipboard file handler can crash on non-UTF-8 watchdog paths #30

Description

@offbyonebit

Severity: medium
Type: bug
Location: clipsync/clipboard.py_ClipboardFileHandler.on_modified(), on_created(), on_moved() (~line 1220+)

Problem: On Linux, watchdog may deliver event.src_path/dest_path as bytes for paths that are not valid UTF-8. The handlers call .decode() without an encoding or error handler, which raises UnicodeDecodeError and can kill the watchdog dispatch thread.

Suggested fix: Use os.fsdecode() (which uses the filesystem encoding and surrogateescape) instead of .decode(), and ensure on_moved() handles a bytes dest_path before passing it to Path().


Filed from a full-source audit of the repo (2026-07-29). Independently confirmed against the source before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditFound in the 2026-07 code auditbugSomething isn't workingseverity:mediumDegraded behaviour or edge case

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions