From 5217a74b7f018b69d8dbfeafc740a4b3105241e4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 5 Jun 2018 22:01:28 +0200 Subject: [PATCH] storage/udisks: return file path in MapUTF8() The absolute udisks:// URI is not usable with InputStream::Open(), and thus we need to return the LocalStorage::MapUTF8() return value instead. --- src/storage/plugins/UdisksStorage.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/storage/plugins/UdisksStorage.cxx b/src/storage/plugins/UdisksStorage.cxx index da1463da5..793781a7d 100644 --- a/src/storage/plugins/UdisksStorage.cxx +++ b/src/storage/plugins/UdisksStorage.cxx @@ -298,10 +298,18 @@ UdisksStorage::MapUTF8(const char *uri_utf8) const noexcept { assert(uri_utf8 != nullptr); - if (StringIsEmpty(uri_utf8)) - return base_uri; + try { + const_cast(this)->MountWait(); - return PathTraitsUTF8::Build(base_uri.c_str(), uri_utf8); + return mounted_storage->MapUTF8(uri_utf8); + } catch (...) { + /* fallback - not usable but the best we can do */ + + if (StringIsEmpty(uri_utf8)) + return base_uri; + + return PathTraitsUTF8::Build(base_uri.c_str(), uri_utf8); + } } const char *