diff --git a/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp b/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp index 0430a176a8ed866e4a3b94b9d36e197b2cf2e6ed..10c53a7c857cb232fae3d15e7194c7d4568e5cdf 100644 --- a/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp +++ b/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp @@ -516,18 +516,16 @@ static int32_t GetNewSession(shared_ptr inoPtr, string assets = "content"; auto metaBase = cloudOpenParams.metaBase; auto filePtr = cloudOpenParams.filePtr; - if (metaBase.fileType == FILE_TYPE_THUMBNAIL) { - assets = "thumbnail"; - } - if (metaBase.fileType == FILE_TYPE_LCD) { - assets = "lcd"; - } - DatabaseManager &databaseManager = DatabaseManager::GetInstance(); - auto rdbStore = databaseManager.GetRdbStore(inoPtr->bundleName, data->userId); - int32_t ret = rdbStore->GetSrcCloudId(inoPtr->cloudId, cloudId); - if (ret) { - LOGE("get %{public}s cloudId failed", assets.c_str()); - return ret; + if (metaBase.fileType == FILE_TYPE_THUMBNAIL || + metaBase.fileType == FILE_TYPE_LCD) { + assets = metaBase.fileType == FILE_TYPE_THUMBNAIL ? "thumbnail" : "lcd"; + DatabaseManager &databaseManager = DatabaseManager::GetInstance(); + auto rdbStore = databaseManager.GetRdbStore(inoPtr->bundleName, data->userId); + auto ret = rdbStore->GetSrcCloudId(inoPtr->cloudId, cloudId); + if (ret != EOK) { + LOGE("get %{public}s cloudId failed, ret = %{public}d", assets.c_str(), ret); + return ret; + } } LOGD("cloudId %s", cloudId.c_str()); filePtr->readSession = database->NewAssetReadSession(data->userId, "file", cloudId, assets, path);