command: reject unsupported URI schemes
When a client-specified URI has a scheme which is not supported, do not try to open it as a local file, but provide a meaningful error message.
This commit is contained in:
parent
c50115f9a2
commit
5aa1afe693
|
@ -450,6 +450,12 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
|
|||
if (isRemoteUrl(path))
|
||||
return addToPlaylist(path, NULL);
|
||||
|
||||
if (uri_has_scheme(path)) {
|
||||
command_error(client, ACK_ERROR_NO_EXIST,
|
||||
"unsupported URI scheme");
|
||||
return COMMAND_RETURN_ERROR;
|
||||
}
|
||||
|
||||
result = addAllIn(path);
|
||||
if (result == (enum playlist_result)-1) {
|
||||
command_error(client, ACK_ERROR_NO_EXIST,
|
||||
|
@ -1223,7 +1229,11 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
|
|||
|
||||
if (isRemoteUrl(path))
|
||||
result = spl_append_uri(path, playlist);
|
||||
else
|
||||
else if (uri_has_scheme(path)) {
|
||||
command_error(client, ACK_ERROR_NO_EXIST,
|
||||
"unsupported URI scheme");
|
||||
return COMMAND_RETURN_ERROR;
|
||||
} else
|
||||
result = addAllInToStoredPlaylist(path, playlist);
|
||||
|
||||
if (result == (enum playlist_result)-1) {
|
||||
|
|
Loading…
Reference in New Issue