aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--doc/protocol.xml5
-rw-r--r--src/command/FileCommands.cxx13
-rw-r--r--src/command/QueueCommands.cxx15
4 files changed, 18 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 553a9d411..08ef096a1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ ver 0.20 (not yet released)
- "search"/"find" have a "window" parameter
- report song duration with milliseconds precision
- "sticker find" can match sticker values
+ - drop the "file:///" prefix for absolute file paths
* tags
- ape, ogg: drop support for non-standard tag "album artist"
affected filetypes: vorbis, flac, opus & all files with ape2 tags
diff --git a/doc/protocol.xml b/doc/protocol.xml
index 49bc20160..f9f8ea346 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -1772,7 +1772,7 @@ OK
<para>
Clients that are connected via UNIX domain socket may
use this command to read the tags of an arbitrary local
- file (URI beginning with "file:///").
+ file (URI is an absolute path).
</para>
</listitem>
</varlistentry>
@@ -1787,8 +1787,7 @@ OK
<para>
Read "comments" (i.e. key-value pairs) from the file
specified by "URI". This "URI" can be a path relative
- to the music directory or a URL in the form
- "file:///foo/bar.ogg".
+ to the music directory or an absolute path.
</para>
<para>
This command may be used to list metadata of remote
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx
index 789aa1f28..1e0f9c585 100644
--- a/src/command/FileCommands.cxx
+++ b/src/command/FileCommands.cxx
@@ -202,11 +202,22 @@ read_file_comments(Client &client, const Path path_fs)
}
+static const char *
+translate_uri(const char *uri)
+{
+ if (memcmp(uri, "file:///", 8) == 0)
+ /* drop the "file://", leave only an absolute path
+ (starting with a slash) */
+ return uri + 7;
+
+ return uri;
+}
+
CommandResult
handle_read_comments(Client &client, ConstBuffer<const char *> args)
{
assert(args.size == 1);
- const char *const uri = args.front();
+ const char *const uri = translate_uri(args.front());
if (memcmp(uri, "file:///", 8) == 0) {
/* read comments from arbitrary local file */
diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx
index 20634652a..d461170fd 100644
--- a/src/command/QueueCommands.cxx
+++ b/src/command/QueueCommands.cxx
@@ -43,18 +43,13 @@
#include <string.h>
static const char *
-translate_uri(Client &client, const char *uri)
+translate_uri(const char *uri)
{
if (memcmp(uri, "file:///", 8) == 0)
/* drop the "file://", leave only an absolute path
(starting with a slash) */
return uri + 7;
- if (PathTraitsUTF8::IsAbsolute(uri)) {
- command_error(client, ACK_ERROR_NO_EXIST, "Malformed URI");
- return nullptr;
- }
-
return uri;
}
@@ -70,9 +65,7 @@ handle_add(Client &client, ConstBuffer<const char *> args)
here */
uri = "";
- uri = translate_uri(client, uri);
- if (uri == nullptr)
- return CommandResult::ERROR;
+ uri = translate_uri(uri);
if (uri_has_scheme(uri) || PathTraitsUTF8::IsAbsolute(uri)) {
const SongLoader loader(client);
@@ -101,9 +94,7 @@ handle_add(Client &client, ConstBuffer<const char *> args)
CommandResult
handle_addid(Client &client, ConstBuffer<const char *> args)
{
- const char *const uri = translate_uri(client, args.front());
- if (uri == nullptr)
- return CommandResult::ERROR;
+ const char *const uri = translate_uri(args.front());
const SongLoader loader(client);
Error error;