Skip to content

obs.copy (and obs.rename) fails on non-ASCII filenames (e.g. with accented characters) #671

@Eric100210

Description

@Eric100210

obs.copy() percent-encodes the source path internally ("café.txt" → "caf%C3%A9.txt", as we see in the traceback). Consequently it raises FileNotFoundError because the file is actually stored as "café.txt".
obs.rename() does the same, causing the same error. The other methods such as obs.head or obs.list work.

Here is a minimal reproduction for obs.copy that you can run:

import tempfile

import obstore as obs
from obstore.store import LocalStore

with tempfile.TemporaryDirectory() as tmpdir:
    store = LocalStore(tmpdir)

    store.put("café.txt", b"hello")

    # Sanity check: head() finds the file just fine.
    assert obs.head(store, "café.txt")["path"] == "café.txt"

    # Bug: copy() percent-encodes the source path and raises FileNotFoundError.
    obs.copy(store, "café.txt", "new.txt")

The error is the following:

FileNotFoundError: Object at location /tmp/tmpnsnnqrot/caf%C3%A9.txt not found: No such file or directory (os error 2)

Debug source:
NotFound {
    path: "/tmp/tmpnsnnqrot/caf%C3%A9.txt",
    source: Os {
        code: 2,
        kind: NotFound,
        message: "No such file or directory",
    },
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions