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.
This commit is contained in:
Max Kellermann 2019-02-22 15:07:40 +01:00
parent 30e0644722
commit 83f7610dd1

View File

@ -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);
}
}