fsspec / fsspec/filesystem_spec

Protocol of URI without authority not correctly idenfied

Open
#1,811 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.4k
Forks
490
Avg merge
2d 3h
Merged PRs (30d)
38

Description

I am currently developing a fsspec driver for a filesystem protocol that does not need/have an authority, such that:

URI = protocol ":" path

is a valid URI.

However, fsspec's split_protocol function seems to assume that an authority is always given, i.e.:

URI = protocol ":" "//" authority path

https://github.com/fsspec/filesystem_spec/blob/6b85a471733124de6e30edf4e16425ee8d30291d/fsspec/core.py#L548-L558

The only exceptions are data (see above) and indirectly file (see here) which are handled specifically.

Are there any issues with supporting also protocols without //authority? E.g. could we just change split_protocol to something like:

def split_protocol(urlpath):
    """Return protocol, path pair"""
    urlpath = stringify_path(urlpath)
    if "://" in urlpath:
        protocol, path = urlpath.split("://", 1)
        if len(protocol) > 1:
            # excludes Windows paths
            return protocol, path
    elif ":/" in urlpath:
        protocol, path = urlpath.split(":/", 1)
        if len(protocol) > 1:
            path = "/" + path
            return protocol, path
    if urlpath.startswith("data:"):
        return urlpath.split(":", 1)
    return None, urlpath

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at fsspec/core.py around split_protocol, lines 548-558, and compare its handling with the special cases for data and file. Verify the URI forms described in the issue, including protocol:path, authority-based URLs, data URLs, and Windows paths; done means protocol-less-authority URIs are identified without breaking existing cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.