f
This commit is contained in:
@@ -1272,8 +1272,19 @@ class HydrusNetwork(Store):
|
||||
IMPORTANT: this method must be side-effect free (do not auto-open a browser).
|
||||
Only explicit user actions (e.g. the get-file cmdlet) should open files.
|
||||
"""
|
||||
file_hash = str(file_hash or "").strip().lower()
|
||||
debug(f"{self._log_prefix()} get_file(hash={file_hash[:12]}..., url={kwargs.get('url')})")
|
||||
|
||||
debug(f"{self._log_prefix()} get_file: start hash={file_hash[:12]}...")
|
||||
# If 'url=True' is passed, we preference the browser URL even if a local path is available.
|
||||
# This is typically used by the 'get-file' cmdlet for interactive viewing.
|
||||
if kwargs.get("url"):
|
||||
base_url = str(self.URL).rstrip("/")
|
||||
access_key = str(self.API)
|
||||
browser_url = (
|
||||
f"{base_url}/get_files/file?hash={file_hash}&Hydrus-Client-API-Access-Key={access_key}"
|
||||
)
|
||||
debug(f"{self._log_prefix()} get_file: returning browser URL per request: {browser_url}")
|
||||
return browser_url
|
||||
|
||||
# Try to get the local disk path if possible (works if Hydrus is on same machine)
|
||||
server_path = None
|
||||
|
||||
Reference in New Issue
Block a user