From 7c7f6527bbf488400ec2f49aafb1005c71cfb626 Mon Sep 17 00:00:00 2001 From: ZhangYuanhuai Date: Tue, 29 Jul 2025 15:24:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8Furi=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangYuanhuai --- .../native/remote_file_share/src/remote_file_share.cpp | 7 ++++--- test/unittest/remote_file_share/remote_file_share_test.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp b/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp index 65483cc16..799b553b3 100644 --- a/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp +++ b/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp @@ -743,9 +743,10 @@ static int32_t SetHmdfsUriDirInfo(struct HmdfsUriInfo &hui, Uri &uri, const std: return SetFileSize(physicalPath, hui); } -static int32_t SetDistributedfilesHmdfsUriDirInfo(struct HmdfsUriInfo &hui, Uri &uri, const std::string &physicalPath) +static int32_t SetDistributedfilesHmdfsUriDirInfo(const std::string &physicalPath, const std::string &uriStr, + struct HmdfsUriInfo &hui, const std::string &networkId) { - hui.uriStr = uri.ToString(); + hui.uriStr = uriStr + NETWORK_PARA + networkId; return SetFileSize(physicalPath, hui); } @@ -848,7 +849,7 @@ static int32_t CheckIfNeedMount(const std::string &bundleName, const std::string return E_OK; } if (IsDistributedFileDir(uri) || IsCloudFileDir(uri)) { - (void)SetDistributedfilesHmdfsUriDirInfo(dfsUriInfo, uri, physicalPath); + (void)SetDistributedfilesHmdfsUriDirInfo(physicalPath, uriStr, dfsUriInfo, networkId); uriToDfsUriMaps.insert({uriStr, dfsUriInfo}); LOGI("bundleName: %{public}s, dfsUri: %{private}s", uriStr.c_str(), dfsUriInfo.uriStr.c_str()); return E_OK; diff --git a/test/unittest/remote_file_share/remote_file_share_test.cpp b/test/unittest/remote_file_share/remote_file_share_test.cpp index 9cbe14a73..e3e86aff2 100644 --- a/test/unittest/remote_file_share/remote_file_share_test.cpp +++ b/test/unittest/remote_file_share/remote_file_share_test.cpp @@ -1294,8 +1294,9 @@ namespace { HmdfsUriInfo hui; OHOS::Uri uri("file://com.demo.a/data/storage/el2/base/remote_share.txt"); string physicalPath = "/data/app/el2/100/base/com.demo.a/remote_share.txt"; + string networkId="networdid123456" - int32_t ret = SetDistributedfilesHmdfsUriDirInfo(hui, uri, physicalPath); + int32_t ret = SetDistributedfilesHmdfsUriDirInfo(physicalPath, uri.ToString(), hui, networkId); EXPECT_EQ(hui.uriStr, uri.ToString()); EXPECT_EQ(ret, NO_SUCH_FILE_ERROR); -- Gitee From 3fe69a393176db07f25d082e08a5a08fd151e33a Mon Sep 17 00:00:00 2001 From: ZhangYuanhuai Date: Tue, 29 Jul 2025 18:37:11 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8Furi=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangYuanhuai --- .../native/remote_file_share/src/remote_file_share.cpp | 2 +- test/unittest/remote_file_share/remote_file_share_test.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp b/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp index 799b553b3..f888fa9ae 100644 --- a/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp +++ b/interfaces/innerkits/native/remote_file_share/src/remote_file_share.cpp @@ -744,7 +744,7 @@ static int32_t SetHmdfsUriDirInfo(struct HmdfsUriInfo &hui, Uri &uri, const std: } static int32_t SetDistributedfilesHmdfsUriDirInfo(const std::string &physicalPath, const std::string &uriStr, - struct HmdfsUriInfo &hui, const std::string &networkId) + struct HmdfsUriInfo &hui, const std::string &networkId) { hui.uriStr = uriStr + NETWORK_PARA + networkId; return SetFileSize(physicalPath, hui); diff --git a/test/unittest/remote_file_share/remote_file_share_test.cpp b/test/unittest/remote_file_share/remote_file_share_test.cpp index e3e86aff2..59dcfa2ef 100644 --- a/test/unittest/remote_file_share/remote_file_share_test.cpp +++ b/test/unittest/remote_file_share/remote_file_share_test.cpp @@ -1294,7 +1294,7 @@ namespace { HmdfsUriInfo hui; OHOS::Uri uri("file://com.demo.a/data/storage/el2/base/remote_share.txt"); string physicalPath = "/data/app/el2/100/base/com.demo.a/remote_share.txt"; - string networkId="networdid123456" + string networkId = "networdid123456"; int32_t ret = SetDistributedfilesHmdfsUriDirInfo(physicalPath, uri.ToString(), hui, networkId); EXPECT_EQ(hui.uriStr, uri.ToString()); -- Gitee From c3a986ffb4ab1571bd812a8a245d385c3706efd5 Mon Sep 17 00:00:00 2001 From: ZhangYuanhuai Date: Wed, 30 Jul 2025 14:08:45 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=BC=8Furi=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ZhangYuanhuai --- test/unittest/remote_file_share/remote_file_share_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unittest/remote_file_share/remote_file_share_test.cpp b/test/unittest/remote_file_share/remote_file_share_test.cpp index 59dcfa2ef..328209ba8 100644 --- a/test/unittest/remote_file_share/remote_file_share_test.cpp +++ b/test/unittest/remote_file_share/remote_file_share_test.cpp @@ -1293,11 +1293,12 @@ namespace { HmdfsUriInfo hui; OHOS::Uri uri("file://com.demo.a/data/storage/el2/base/remote_share.txt"); + OHOS::Uri uri_res("file://com.demo.a/data/storage/el2/base/remote_share.txt?networkid=networdid123456"); string physicalPath = "/data/app/el2/100/base/com.demo.a/remote_share.txt"; string networkId = "networdid123456"; int32_t ret = SetDistributedfilesHmdfsUriDirInfo(physicalPath, uri.ToString(), hui, networkId); - EXPECT_EQ(hui.uriStr, uri.ToString()); + EXPECT_EQ(hui.uriStr, uri_res.ToString()); EXPECT_EQ(ret, NO_SUCH_FILE_ERROR); GTEST_LOG_(INFO) << "RemoteFileShareTest-end Remote_file_share_SetDistributedfilesHmdfsUriDirInfo_0001"; -- Gitee