diff --git a/schema_salad/fetcher.py b/schema_salad/fetcher.py index 72613ea00..8541c27fa 100644 --- a/schema_salad/fetcher.py +++ b/schema_salad/fetcher.py @@ -95,7 +95,10 @@ def fetch_text(self, url: str, content_types: Optional[List[str]] = None) -> str raise ValidationException(f"Unsupported scheme in url: {url}") def check_exists(self, url: str) -> bool: - if url in self.cache: + entry = self.cache.get(url) + if entry is False: + return False + elif entry is not None: return True split = urllib.parse.urlsplit(url) @@ -108,6 +111,7 @@ def check_exists(self, url: str) -> bool: resp = self.session.head(url, allow_redirects=True) resp.raise_for_status() except Exception: + self.cache[url] = False return False self.cache[url] = True return True