From b8ef9b9ade46c47d67dcf5c137c8ff945fdc7b99 Mon Sep 17 00:00:00 2001 From: Anton Dubovik Date: Mon, 22 Jul 2024 17:18:53 +0100 Subject: [PATCH] fix: fixed bug in file accessibility check --- aidial_adapter_dial/utils/storage.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/aidial_adapter_dial/utils/storage.py b/aidial_adapter_dial/utils/storage.py index 5442c46..337f3d8 100644 --- a/aidial_adapter_dial/utils/storage.py +++ b/aidial_adapter_dial/utils/storage.py @@ -72,12 +72,11 @@ async def is_accessible( ) -> bool: try: await self._get_metadata(url, session) + log.debug(f"file is accessible: url={url!r}") + return True except AccessDeniedError: log.debug(f"file isn't accessible: url={url!r}") return False - finally: - log.debug(f"file is accessible: url={url!r}") - return True def to_metadata_url(self, url: str) -> str: """ @@ -87,9 +86,7 @@ def to_metadata_url(self, url: str) -> str: return urljoin(metadata_url, url, allow_fragments=True) async def _get_metadata( - self, - url: str, - session: aiohttp.ClientSession, + self, url: str, session: aiohttp.ClientSession ) -> dict: metadata_url = self.to_metadata_url(url)