diff options
author | Max Kellermann <max@musicpd.org> | 2019-02-22 15:07:40 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-02-22 15:07:40 +0100 |
commit | 83f7610dd14b2fbfdbc2bcd1cda269d055e6148c (patch) | |
tree | 18c86145c8777279b0616b3ec36a5ff5e7dfb9a0 | |
parent | 30e0644722fbcf0bf39a4086827bab72d81bb765 (diff) |
storage/udisks2: move empty string check out of the fallback block in MapUTF8()
Even if the LocalStorage is available, return the "udisks://" URI when
the MapUTF8() parameter is an empty string. This fixes the mount URI
in the state file.
-rw-r--r-- | src/storage/plugins/UdisksStorage.cxx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/storage/plugins/UdisksStorage.cxx b/src/storage/plugins/UdisksStorage.cxx index 07ba6f45f..60f1e27e0 100644 --- a/src/storage/plugins/UdisksStorage.cxx +++ b/src/storage/plugins/UdisksStorage.cxx @@ -331,16 +331,18 @@ UdisksStorage::MapUTF8(const char *uri_utf8) const noexcept { assert(uri_utf8 != nullptr); + if (StringIsEmpty(uri_utf8)) + /* kludge for a special case: return the "udisks://" + URI if the parameter is an empty string to fix the + mount URIs in the state file */ + return base_uri; + try { const_cast<UdisksStorage *>(this)->MountWait(); 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); } } |