From 8de58a13d25cc126e94546ef8e476f1fdf121fa1 Mon Sep 17 00:00:00 2001 From: panqiangbiao Date: Thu, 19 May 2022 21:10:15 +0800 Subject: [PATCH] fix uri empty issue Signed-off-by: panqiangbiao --- services/src/fileoper/media_file_utils.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/src/fileoper/media_file_utils.cpp b/services/src/fileoper/media_file_utils.cpp index dcdd31e4..f8f59ab3 100644 --- a/services/src/fileoper/media_file_utils.cpp +++ b/services/src/fileoper/media_file_utils.cpp @@ -377,6 +377,10 @@ bool MediaFileUtils::GetFileInfo(shared_ptr resul result->GetString(mediaTableMap[index++].first, id); string uri; result->GetString(mediaTableMap[index++].first, uri); + if (uri.empty()) { + DEBUG_LOG("empty uri from medialibrary"); + uri = Media::MEDIALIBRARY_FILE_URI; + } string path = uri + "/" + id; fileInfo->SetPath(path); @@ -441,4 +445,4 @@ int MediaFileUtils::DoGetRoot(const std::string &name, const std::string &path, return SUCCESS; } } // namespace FileManagerService -} // namespace OHOS \ No newline at end of file +} // namespace OHOS -- Gitee