Skip to content

Commit

Permalink
Urls do not require a netloc (in rfc1808)
Browse files Browse the repository at this point in the history
- See https://www.rfc-editor.org/rfc/rfc1808.html#section-2.1 . So, for example, gitpythonfs:// is valid and works in fsspec.
- However in bucket-based systems, the bucket name is where the netloc would be - eg s3://bucket_name.  But luckily s3fs (and probably az, gcs etc) already gives helpful error messages if no bucket name given, wrong bucket name given etc.
- As a ToDo, this rule could test only those protocols whose fsspec implementation needs netloc, rather than excluding a few protocols as is done here. But we don't know which protocols this rule was initially added for.
  • Loading branch information
deanja committed Feb 15, 2024
1 parent 43c6180 commit c16a9dc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dlt/common/storages/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ def protocol(self) -> str:

def on_resolved(self) -> None:
url = urlparse(self.bucket_url)
if not url.path and not url.netloc:
raise ConfigurationValueError(
"File path or netloc missing. Field bucket_url of FilesystemClientConfiguration"
" must contain valid url with a path or host:password component."
)
if url.scheme not in ("gitpythonfs", "github", "git"):
if not url.path and not url.netloc:
raise ConfigurationValueError(
"File path or netloc missing. Field bucket_url of FilesystemClientConfiguration"
" must contain valid url with a path or host:password component."
)
# this is just a path in a local file system
if url.path == self.bucket_url:
url = url._replace(scheme="file")
Expand Down

0 comments on commit c16a9dc

Please sign in to comment.