diff options
author | Max Kellermann <max@duempel.org> | 2015-10-20 11:25:46 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-10-20 11:25:46 +0200 |
commit | 81ce684b35ca498ef5d8c738799284476f4573a0 (patch) | |
tree | d8b33f9c4bc101e33e4e5f814df78b70509869eb /src/command | |
parent | 42bd888946d7fd00a8b6a231429122ca5ab0898a (diff) |
command/FileCommands: fix access to absolute paths in "readcomments"
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/FileCommands.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx index 73b9b3dbe..f7e16a0d2 100644 --- a/src/command/FileCommands.cxx +++ b/src/command/FileCommands.cxx @@ -218,9 +218,9 @@ handle_read_comments(Client &client, Request args, Response &r) assert(args.size == 1); const char *const uri = translate_uri(args.front()); - if (memcmp(uri, "file:///", 8) == 0) { + if (PathTraitsUTF8::IsAbsolute(uri)) { /* read comments from arbitrary local file */ - const char *path_utf8 = uri + 7; + const char *path_utf8 = uri; AllocatedPath path_fs = AllocatedPath::FromUTF8(path_utf8); if (path_fs.IsNull()) { r.Error(ACK_ERROR_NO_EXIST, "unsupported file name"); @@ -234,7 +234,7 @@ handle_read_comments(Client &client, Request args, Response &r) return read_file_comments(r, path_fs); } else if (uri_has_scheme(uri)) { return read_stream_comments(r, uri); - } else if (!PathTraitsUTF8::IsAbsolute(uri)) { + } else { #ifdef ENABLE_DATABASE const Storage *storage = client.GetStorage(); if (storage == nullptr) { @@ -259,8 +259,5 @@ handle_read_comments(Client &client, Request args, Response &r) r.Error(ACK_ERROR_NO_EXIST, "No such file"); return CommandResult::ERROR; #endif - } else { - r.Error(ACK_ERROR_NO_EXIST, "No such file"); - return CommandResult::ERROR; } } |