mirror of
https://gitee.com/openharmony/filemanagement_app_file_service
synced 2025-02-17 07:10:43 +00:00
mediauri bug修复
Signed-off-by: lvyuanyuan <lvyuanyuan7@huawei.com> Change-Id: Ie63ca1b45cda2038c70ef7442fcb29c011ffacdc
This commit is contained in:
parent
193ea0a9e6
commit
03eb0caa21
@ -280,12 +280,11 @@ int32_t SandboxHelper::GetPhysicalPath(const std::string &fileUri, const std::st
|
||||
{
|
||||
Uri uri(fileUri);
|
||||
string bundleName = uri.GetAuthority();
|
||||
string sandboxPath = SandboxHelper::Decode(uri.GetPath());
|
||||
|
||||
if (bundleName == MEDIA) {
|
||||
return GetMediaPhysicalPath(sandboxPath, userId, physicalPath);
|
||||
return GetMediaPhysicalPath(uri.GetPath(), userId, physicalPath);
|
||||
}
|
||||
|
||||
string sandboxPath = SandboxHelper::Decode(uri.GetPath());
|
||||
if ((sandboxPath.find(FILE_MANAGER_URI_HEAD) == 0 && bundleName != FILE_MANAGER_AUTHORITY) ||
|
||||
(sandboxPath.find(FUSE_URI_HEAD) == 0 && bundleName != DLP_MANAGER_BUNDLE_NAME)) {
|
||||
return -EINVAL;
|
||||
|
@ -389,11 +389,18 @@ HWTEST_F(FileShareTest, File_share_GetPhysicalPath_0004, testing::ext::TestSize.
|
||||
HWTEST_F(FileShareTest, File_share_GetPhysicalPath_0005, testing::ext::TestSize.Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "FileShareTest-begin File_share_GetPhysicalPath_0005";
|
||||
std::string fileUri = "file://media/Photo/12/IMG_12345_999999/test.jpg";
|
||||
std::string strPrefix = "file://media/";
|
||||
std::string fileUri = "Photo/12/IMG_12345_999999/test.jpg";
|
||||
std::string physicalPath;
|
||||
int32_t ret = SandboxHelper::GetPhysicalPath(fileUri, "100", physicalPath);
|
||||
int32_t ret = SandboxHelper::GetPhysicalPath(strPrefix + SandboxHelper::Encode(fileUri), "100", physicalPath);
|
||||
EXPECT_EQ(ret, E_OK);
|
||||
EXPECT_EQ(physicalPath, "/mnt/hmdfs/100/account/cloud_merge_view/files/Photo/575/IMG_12345_999999.jpg");
|
||||
|
||||
std::string fileUri2 = "Photo/12/IMG_12345_999999/test .jpg";
|
||||
std::string physicalPath2;
|
||||
ret = SandboxHelper::GetPhysicalPath(strPrefix + SandboxHelper::Encode(fileUri2), "100", physicalPath2);
|
||||
EXPECT_EQ(ret, E_OK);
|
||||
EXPECT_EQ(physicalPath2, "/mnt/hmdfs/100/account/cloud_merge_view/files/Photo/575/IMG_12345_999999.jpg");
|
||||
GTEST_LOG_(INFO) << "FileShareTest-end File_share_GetPhysicalPath_0005";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user