Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ playground

# Automatically added by osw.auth.CredentialManager.save_credentials_to_file:
*/osw_files/*

*/accounts.pwd.yaml
5 changes: 4 additions & 1 deletion src/osw/controller/file/wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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
Expand All @@ -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"]
Expand Down
Loading