diff --git a/interfaces/innerkits/native/file_uri/src/file_uri.cpp b/interfaces/innerkits/native/file_uri/src/file_uri.cpp index 277fa159200426aaa3b6e58aa01201630567c9df..2973a554aebef8f890ea558f66f686a96ae4185b 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 613d1cf2d10e23e5482b400cdb309cc761a78515..d5b9cd06e8e4bd37c96ef6a939b2b5e5b64dbfd9 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;