diff --git a/.gitignore b/.gitignore index bdbc610..7040c33 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,5 @@ playground # Automatically added by osw.auth.CredentialManager.save_credentials_to_file: */osw_files/* + +*/accounts.pwd.yaml diff --git a/src/osw/controller/file/wiki.py b/src/osw/controller/file/wiki.py index f078af3..19e7643 100644 --- a/src/osw/controller/file/wiki.py +++ b/src/osw/controller/file/wiki.py @@ -40,6 +40,7 @@ def get(self) -> IO: # use web api full_title = f"{self.namespace}:{self.title}" web_api_failed = False + file_not_found = False response = None try: url = ( @@ -54,7 +55,7 @@ def get(self) -> IO: if api_error is not None: if api_error == "download-notfound": # File does not exist - raise Exception("File does not exist: " + full_title) + file_not_found = True elif api_error == "badvalue": # Extension FileApi not installed on the server web_api_failed = True @@ -64,6 +65,8 @@ def get(self) -> IO: except Exception: web_api_failed = True + if file_not_found: + raise Exception("File does not exist: " + full_title) if web_api_failed: # fallback: use direct download url = file.imageinfo["url"]