Commit 63cd47d3 authored by Erin's avatar Erin
Browse files

Handle invalid lookup URIs

parent fefcdf31
...@@ -375,9 +375,14 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider): ...@@ -375,9 +375,14 @@ class FunkwhaleLibraryProvider(backend.LibraryProvider):
"artist": lambda id: client.list_tracks({"artist": id})["results"], "artist": lambda id: client.list_tracks({"artist": id})["results"],
} }
type, id = parse_uri(uri) try:
payload = config[type](id) type, id = parse_uri(uri)
return [convert_to_track(row, cache=self.cache) for row in payload] except (IndexError, ValueError):
logger.info(f"Lookup failed: invalid uri '{uri}'")
return []
else:
payload = config[type](id)
return [convert_to_track(row, cache=self.cache) for row in payload]
def parse_uri(uri): def parse_uri(uri):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment