Skip to content

Commit fde8985

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 38e7ffd commit fde8985

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/specify_cli/extensions/_commands.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,8 @@ def extension_add(
428428

429429
try:
430430
parsed = urlparse(from_url)
431-
# Read .hostname inside the try: a bracketed-but-invalid IPv6
432-
# authority (e.g. "https://[not-an-ip]/x.zip") parses cleanly under
433-
# urlparse() on Python < 3.14 and only raises ValueError lazily on
434-
# the first .hostname access (eager at urlparse() on 3.14+). Reading
435-
# it here keeps that ValueError inside the guard instead of leaking a
436-
# raw traceback past the CLI. Reuse the value below.
431+
# Keep parsing and hostname extraction in the same guard so any
432+
# ValueError is converted to the CLI's normal invalid-URL error.
437433
hostname = parsed.hostname
438434
except ValueError:
439435
console.print(f"[red]Error:[/red] Invalid URL: {_escape_markup(from_url)}")

0 commit comments

Comments
 (0)