aboutsummaryrefslogtreecommitdiffstats
path: root/src/QueueCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-06-24 16:17:46 +0200
committerMax Kellermann <max@duempel.org>2013-06-24 16:17:46 +0200
commitef48eca9cac875f65622daf500bd702e20d666f3 (patch)
tree52fe455c347fd0f0ab14b471e2482c17c8aed5e6 /src/QueueCommands.cxx
parent906d2fbadf075b7d8e3a5be7134a9bebb09b7285 (diff)
parente9e55b08127dc45b4c6045e1f42e34115086a521 (diff)
downloadmpd-ef48eca9cac875f65622daf500bd702e20d666f3.tar.gz
mpd-ef48eca9cac875f65622daf500bd702e20d666f3.tar.xz
mpd-ef48eca9cac875f65622daf500bd702e20d666f3.zip
Merge branch 'master' of git://git.musicpd.org/dk/mpd
Diffstat (limited to 'src/QueueCommands.cxx')
-rw-r--r--src/QueueCommands.cxx27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/QueueCommands.cxx b/src/QueueCommands.cxx
index aac6d5a51..210b1501a 100644
--- a/src/QueueCommands.cxx
+++ b/src/QueueCommands.cxx
@@ -32,6 +32,7 @@
#include "protocol/Result.hxx"
#include "ls.hxx"
#include "util/UriUtil.hxx"
+#include "fs/Path.hxx"
#include <string.h>
@@ -42,13 +43,20 @@ handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[])
enum playlist_result result;
if (strncmp(uri, "file:///", 8) == 0) {
- const char *path = uri + 7;
+ const char *path_utf8 = uri + 7;
+ const Path path_fs = Path::FromUTF8(path_utf8);
+
+ if (path_fs.IsNull()) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "unsupported file name");
+ return COMMAND_RETURN_ERROR;
+ }
GError *error = NULL;
- if (!client_allow_file(client, path, &error))
+ if (!client_allow_file(client, path_fs, &error))
return print_error(client, error);
- result = client->partition.AppendFile(path);
+ result = client->partition.AppendFile(path_utf8);
return print_playlist_result(client, result);
}
@@ -78,13 +86,20 @@ handle_addid(Client *client, int argc, char *argv[])
enum playlist_result result;
if (strncmp(uri, "file:///", 8) == 0) {
- const char *path = uri + 7;
+ const char *path_utf8 = uri + 7;
+ const Path path_fs = Path::FromUTF8(path_utf8);
+
+ if (path_fs.IsNull()) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "unsupported file name");
+ return COMMAND_RETURN_ERROR;
+ }
GError *error = NULL;
- if (!client_allow_file(client, path, &error))
+ if (!client_allow_file(client, path_fs, &error))
return print_error(client, error);
- result = client->partition.AppendFile(path, &added_id);
+ result = client->partition.AppendFile(path_utf8, &added_id);
} else {
if (uri_has_scheme(uri) && !uri_supported_scheme(uri)) {
command_error(client, ACK_ERROR_NO_EXIST,