kl
This commit is contained in:
@@ -326,10 +326,8 @@ class Add_File(Cmdlet):
|
||||
is_storage_backend_location = False
|
||||
if location:
|
||||
try:
|
||||
# Check against the cached startup list of available backends
|
||||
from cmdlet._shared import SharedArgs
|
||||
available_backends = SharedArgs.get_store_choices(config)
|
||||
is_storage_backend_location = location in available_backends
|
||||
store_for_lookup = storage_registry or Store(config)
|
||||
is_storage_backend_location = Add_File._resolve_backend_by_name(store_for_lookup, str(location)) is not None
|
||||
except Exception:
|
||||
is_storage_backend_location = False
|
||||
|
||||
@@ -608,8 +606,8 @@ class Add_File(Cmdlet):
|
||||
if location:
|
||||
try:
|
||||
store = storage_registry or Store(config)
|
||||
backends = store.list_backends()
|
||||
if location in backends:
|
||||
resolved_backend = Add_File._resolve_backend_by_name(store, str(location))
|
||||
if resolved_backend is not None:
|
||||
code = self._handle_storage_backend(
|
||||
item,
|
||||
media_path,
|
||||
|
||||
@@ -2685,6 +2685,14 @@ class Download_File(Cmdlet):
|
||||
pass
|
||||
|
||||
try:
|
||||
if HydrusNetwork is not None and isinstance(backend, HydrusNetwork):
|
||||
hashes = backend.find_hashes_by_url(canonical_url) or []
|
||||
for existing_hash in hashes:
|
||||
normalized = sh.normalize_hash(existing_hash)
|
||||
if normalized:
|
||||
return normalized
|
||||
continue
|
||||
|
||||
hits = backend.search(f"url:{canonical_url}", limit=5) or []
|
||||
except Exception:
|
||||
hits = []
|
||||
|
||||
Reference in New Issue
Block a user