LocateUri: implement UriPluginKind::STORAGE properly
This way, URI schemes supported by arbitrary storage plugins are allowed. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1270
This commit is contained in:
parent
ef24cfa523
commit
cf554d306d
1
NEWS
1
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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue