From 460cfba6ff76ed58e6f6778cfeb9dd424d7fe75a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Nov 2014 21:26:31 +0100 Subject: [PATCH] QueueCommands: workaround for buggy clients that send "add /" --- NEWS | 2 ++ src/command/QueueCommands.cxx | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cd69a7a6e..dae99f74a 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.19.4 (not yet released) +* protocol + - workaround for buggy clients that send "add /" * decoder - opus: add MIME types audio/ogg and application/ogg diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx index 36c8ac84f..d0b789eb1 100644 --- a/src/command/QueueCommands.cxx +++ b/src/command/QueueCommands.cxx @@ -61,7 +61,16 @@ translate_uri(Client &client, const char *uri) CommandResult handle_add(Client &client, gcc_unused unsigned argc, char *argv[]) { - const char *const uri = translate_uri(client, argv[1]); + const char *uri = argv[1]; + if (memcmp(uri, "/", 2) == 0) + /* this URI is malformed, but some clients are buggy + and use "add /" to add the whole database, which + was never intended to work, but once did; in order + to retain backwards compatibility, work around this + here */ + uri = ""; + + uri = translate_uri(client, uri); if (uri == nullptr) return CommandResult::ERROR;