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:
parent
30e0644722
commit
83f7610dd1
@ -331,16 +331,18 @@ UdisksStorage::MapUTF8(const char *uri_utf8) const noexcept
|
|||||||
{
|
{
|
||||||
assert(uri_utf8 != nullptr);
|
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 {
|
try {
|
||||||
const_cast<UdisksStorage *>(this)->MountWait();
|
const_cast<UdisksStorage *>(this)->MountWait();
|
||||||
|
|
||||||
return mounted_storage->MapUTF8(uri_utf8);
|
return mounted_storage->MapUTF8(uri_utf8);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
/* fallback - not usable but the best we can do */
|
/* 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);
|
return PathTraitsUTF8::Build(base_uri.c_str(), uri_utf8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user