Skip to content

[BUG] canonicalize Path Fallback May Return Relative Path #212

@xyz080125

Description

@xyz080125

Project

vgrep

Description

In search.rs line 43, std::fs::canonicalize(path).unwrap_or_else(|_| path.to_path_buf()) falls back to the original path if canonicalization fails. If the original path is relative, this could cause issues with database queries that expect absolute paths.

Error Message

Debug Logs

System Information

OS: Any
Rust Version: 1.75+

Screenshots

No response

Steps to Reproduce

  1. Search with a relative path that doesn't exist yet (e.g., a new directory)
  2. Observe query behavior

Expected Behavior

Either fail clearly if path doesn't exist, or convert to absolute path using current_dir

Actual Behavior

May use relative path for database query, causing incorrect path matching

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions