Skip to content

Commit

Permalink
Adjust joinurl() docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Feb 22, 2024
1 parent 9ca1d30 commit 728882f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions dandi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,11 @@ def _get_instance(
dandi_id = api_url

Check warning on line 630 in dandi/utils.py

View check run for this annotation

Codecov / codecov/patch

dandi/utils.py#L630

Added line #L630 was not covered by tests
return DandiInstance(
name=dandi_id,
gui=server_info.services.webui.url
if server_info.services.webui is not None
else None,
gui=(
server_info.services.webui.url
if server_info.services.webui is not None
else None
),
api=api_url,
)

Expand Down Expand Up @@ -871,11 +873,14 @@ def post_upload_size_check(path: Path, pre_check_size: int, erroring: bool) -> N

def joinurl(base: str, path: str) -> str:
"""
Append a slash-separated ``path`` to a base URL ``base``. The two
Append a slash-separated ``path`` to a base HTTP(S) URL ``base``. The two
components are separated by a single slash, removing any excess slashes
that would be present after naïve concatenation.
If ``path`` is already an absolute URL, it is returned unchanged.
If ``path`` is already an absolute HTTP(S) URL, it is returned unchanged.
Note that this function differs from `urllib.parse.urljoin()` when the path
portion of ``base`` is nonempty and does not end in a slash.
"""
if path.lower().startswith(("http://", "https://")):
return path
Expand Down

0 comments on commit 728882f

Please sign in to comment.