Skip to content

Commit

Permalink
fix: skip netrc when parse failed (#121)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed Jun 4, 2024
1 parent 6183c69 commit 07d5dad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/unearth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def commonprefix(*m: str) -> str:
def get_netrc_auth(url: str) -> tuple[str, str] | None:
"""Get the auth for the given url from the netrc file."""
try:
from netrc import netrc
from netrc import NetrcParseError, netrc
except ImportError:
return None
from httpx import URL
Expand All @@ -297,7 +297,7 @@ def get_netrc_auth(url: str) -> tuple[str, str] | None:

try:
authenticator = netrc(os.getenv("NETRC"))
except (FileNotFoundError, TypeError):
except (NetrcParseError, OSError):
return None
info = authenticator.authenticators(hostname)

Expand Down

0 comments on commit 07d5dad

Please sign in to comment.