aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-12-16 21:23:29 +0100
committerMax Kellermann <max@duempel.org>2008-12-16 21:23:29 +0100
commit5aa1afe69344aa6b6be5ac55c79fce14e1f79d53 (patch)
tree927312b873f7ec61d1d239e601767baeabbbd6f4 /src/command.c
parentc50115f9a2c0b5f8fc89906629386b74139212cf (diff)
downloadmpd-5aa1afe69344aa6b6be5ac55c79fce14e1f79d53.tar.gz
mpd-5aa1afe69344aa6b6be5ac55c79fce14e1f79d53.tar.xz
mpd-5aa1afe69344aa6b6be5ac55c79fce14e1f79d53.zip
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.
Diffstat (limited to '')
-rw-r--r--src/command.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c
index bc5273637..9793830c1 100644
--- a/src/command.c
+++ b/src/command.c
@@ -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) {