diff --git a/NEWS b/NEWS index 3c7871c0d..979f928e7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ver 0.23 (not yet released) * protocol - new command "getvol" - show the audio format in "playlistinfo" + - support "listfiles" with arbitrary storage plugins * database - proxy: require MPD 0.20 or later - proxy: require libmpdclient 2.11 or later diff --git a/src/LocateUri.cxx b/src/LocateUri.cxx index 543f40938..c534a6db7 100644 --- a/src/LocateUri.cxx +++ b/src/LocateUri.cxx @@ -22,6 +22,7 @@ #include "client/Client.hxx" #include "fs/AllocatedPath.hxx" #include "ls.hxx" +#include "storage/Registry.hxx" #include "util/ASCII.hxx" #include "util/UriExtract.hxx" @@ -67,11 +68,15 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri { switch (kind) { case UriPluginKind::INPUT: - case UriPluginKind::STORAGE: // TODO: separate check for storage plugins if (!uri_supported_scheme(uri)) throw std::invalid_argument("Unsupported URI scheme"); break; + case UriPluginKind::STORAGE: + /* plugin support will be checked after the + Storage::MapToRelativeUTF8() call */ + break; + case UriPluginKind::PLAYLIST: /* for now, no validation for playlist URIs; this is more complicated because there are three ways to @@ -88,6 +93,10 @@ LocateAbsoluteUri(UriPluginKind kind, const char *uri return LocatedUri(LocatedUri::Type::RELATIVE, suffix.data()); } + + if (kind == UriPluginKind::STORAGE && + GetStoragePluginByUri(uri) == nullptr) + throw std::invalid_argument("Unsupported URI scheme"); #endif return LocatedUri(LocatedUri::Type::ABSOLUTE, uri);