Skip to content

MEDIA: token parser rejects Windows drive-letter paths #30973

@Ragingwasabi

Description

@Ragingwasabi

Description

The isValidMedia() function in src/media/parse.ts (compiled: dist/media/parse.js) only accepts paths starting with /, ./, ../, ~, or http(s)://. On Windows, paths like C:\Users\... or C:/Users/... are rejected, making it impossible for CLI backends (like claude-cli) to send media back via MEDIA: tokens.

Current behavior

// Windows paths fall through to `return false`
function isValidMedia(candidate, opts) {
    if (/^https?:\/\//i.test(candidate)) return true;
    if (candidate.startsWith("/")) return true;
    if (candidate.startsWith("./")) return true;
    if (candidate.startsWith("../")) return true;
    if (candidate.startsWith("~")) return true;
    return false;
}

When a CLI backend on Windows outputs MEDIA:C:\Users\path\to\image.jpg, the parser silently drops the token and no media is sent.

Expected behavior

Windows absolute paths (e.g. C:\..., D:/...) should be recognized as valid media paths.

Suggested fix

Add a check for Windows drive-letter paths:

// Match drive letters like C:\ or C:/
if (/^[a-zA-Z]:[/\]/.test(candidate)) return true;

Environment

  • Windows 11
  • Clawdbot 2026.1.24-3
  • Backend: Claude Code CLI (claude-cli/sonnet)
  • Discord channel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions