From 166a3aedee98292e88703291a72a20529e6ee764 Mon Sep 17 00:00:00 2001 From: cuiruibin Date: Thu, 28 Mar 2024 15:25:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=A8=E8=AE=BE=E5=A4=87=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E8=B7=AF=E5=BE=84=E8=BD=AC=E6=8D=A2=20Signed?= =?UTF-8?q?-off-by:=20cuiruibin=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interfaces/innerkits/native/file_uri/src/file_uri.cpp | 3 ++- test/unittest/file_uri_ndk_test/file_uri_ndk_test.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/interfaces/innerkits/native/file_uri/src/file_uri.cpp b/interfaces/innerkits/native/file_uri/src/file_uri.cpp index 277fa1592..2973a554a 100644 --- a/interfaces/innerkits/native/file_uri/src/file_uri.cpp +++ b/interfaces/innerkits/native/file_uri/src/file_uri.cpp @@ -89,7 +89,8 @@ string FileUri::GetRealPath() return realPath; } - if ((bundleName != "") && (bundleName != CommonFunc::GetSelfBundleName())) { + if (((bundleName != "") && (bundleName != CommonFunc::GetSelfBundleName())) || + uri_.ToString().find(NETWORK_PARA) != string::npos) { realPath = PATH_SHARE + MODE_RW + bundleName + sandboxPath; if (access(realPath.c_str(), F_OK) != 0) { realPath = PATH_SHARE + MODE_R + bundleName + sandboxPath; diff --git a/test/unittest/file_uri_ndk_test/file_uri_ndk_test.cpp b/test/unittest/file_uri_ndk_test/file_uri_ndk_test.cpp index 613d1cf2d..d5b9cd06e 100644 --- a/test/unittest/file_uri_ndk_test/file_uri_ndk_test.cpp +++ b/test/unittest/file_uri_ndk_test/file_uri_ndk_test.cpp @@ -151,7 +151,8 @@ HWTEST_F(NDKFileUriTest, get_path_from_uri_test_004, TestSize.Level1) fileUriStr += "data/storage/el2/base/haps/entry/files/GetPathFromUri004.txt"; fileUriStr += "?networkid=64799ecdf70788e396f454ff4a6e6ae4b09e20227c39c21f6e67a2aacbcef7b9"; const char *fileUri = fileUriStr.c_str(); - std::string filePathStr = "/data/storage/el2/distributedfiles/.remote_share/"; + std::string filePathStr = + "/data/storage/el2/share/r/" + BUNDLE_A + "/data/storage/el2/distributedfiles/.remote_share/"; filePathStr += "data/storage/el2/base/haps/entry/files/GetPathFromUri004.txt"; const char *filePath = filePathStr.c_str(); char *result = nullptr; -- Gitee