Skip to content

LocalStore file handling of empty paths is inconsistent with S3Store, GCSStore, etc. #635

@pfrommerd

Description

@pfrommerd

When using an http-based store or s3store with a prefix that points directly to an object/file, calling get("")
will retrieve the object, i.e.

store = obstore.store.from_url("s3://my-bucket/bar.txt")
store.get("") # <-- returns bar.txt object

however for file-based paths the following does not work

store = obstore.store.from_url("file:///home/foo/bar.txt")
store.get("") # <-- throws error!

this throws the error

Generic LocalFileSystem error: Filenames containing trailing '/#\d+/' are not supported:                                                                                                                                                                           
Debug source:                                                                                                                                                      
Generic {                                                                                                                                                          
    store: "LocalFileSystem",                                                                                                                                      
    source: InvalidPath {                                                                                                                                          
        path: "",                                                                                                                                                  
    },                                                                                                                                                             
}

Ideally LocalStore would also support "". This makes tooling for downloading a file://, s3://, gs:// url easy.

Alternatively this issue could be worked around if there were a way of constructing a store from a url, but unprefixed and returning the prefix separately, i.e. something like

store, prefix = obstore.store.unprefixed_from_url("file://foo/bar.txt")
store.get(prefix) # <-- works for file:// now!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions