From 80e5b6a1d27da19992f370c7a3ef89ce428db26a Mon Sep 17 00:00:00 2001 From: zhangkaixiang Date: Thu, 10 Aug 2023 17:50:31 +0800 Subject: [PATCH] fix file share json bug Signed-off-by: zhangkaixiang --- interfaces/common/file_share_sandbox.json | 68 +++++++++---------- .../native/file_uri/src/file_uri.cpp | 3 +- 2 files changed, 36 insertions(+), 35 deletions(-) diff --git a/interfaces/common/file_share_sandbox.json b/interfaces/common/file_share_sandbox.json index 3f69410f7..55e9cfc88 100644 --- a/interfaces/common/file_share_sandbox.json +++ b/interfaces/common/file_share_sandbox.json @@ -1,55 +1,55 @@ { "mount-path-map" : [{ - "sandbox-path" : "/data/storage/el1/bundle", - "src-path" : "/data/app/el1/bundle/public/" + "sandbox-path" : "/data/storage/el1/bundle/", + "src-path" : "/data/app/el1/bundle/public//" }, { - "sandbox-path" : "/data/storage/el2/base", - "src-path" : "/data/app/el2//base/" + "sandbox-path" : "/data/storage/el2/base/", + "src-path" : "/data/app/el2//base//" }, { - "sandbox-path" : "/data/storage/el1/database", - "src-path" : "/data/app/el1//database/" + "sandbox-path" : "/data/storage/el1/database/", + "src-path" : "/data/app/el1//database//" }, { - "sandbox-path" : "/data/storage/el2/database", - "src-path" : "/data/app/el2//database/" + "sandbox-path" : "/data/storage/el2/database/", + "src-path" : "/data/app/el2//database//" }, { - "sandbox-path" : "/data/storage/el1/base", - "src-path" : "/data/app/el1//base/" + "sandbox-path" : "/data/storage/el1/base/", + "src-path" : "/data/app/el1//base//" }, { - "sandbox-path" : "/data/storage/ark-cache", - "src-path" : "/data/local/ark-cache/" + "sandbox-path" : "/data/storage/ark-cache/", + "src-path" : "/data/local/ark-cache//" }, { - "sandbox-path" : "/data/storage/ark-profile", - "src-path" : "/data/local/ark-profile//" + "sandbox-path" : "/data/storage/ark-profile/", + "src-path" : "/data/local/ark-profile///" }, { - "sandbox-path" : "/data/storage/el2/distributedfiles", - "src-path" : "/mnt/hmdfs//account/merge_view/data/" + "sandbox-path" : "/data/storage/el2/distributedfiles/", + "src-path" : "/mnt/hmdfs//account/merge_view/data//" }, { - "sandbox-path" : "/mnt/data/fuse", - "src-path" : "/mnt/data//fuse" + "sandbox-path" : "/mnt/data/fuse/", + "src-path" : "/mnt/data//fuse/" }, { - "sandbox-path" : "/storage/Users/currentUser/Documents", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Documents" + "sandbox-path" : "/storage/Users/currentUser/Documents/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Documents/" }, { - "sandbox-path" : "/storage/Users/currentUser/Download", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Download" + "sandbox-path" : "/storage/Users/currentUser/Download/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Download/" }, { - "sandbox-path" : "/storage/Users/currentUser/Desktop", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Desktop" + "sandbox-path" : "/storage/Users/currentUser/Desktop/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Desktop/" }, { - "sandbox-path" : "/storage/Users/currentUser", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Docs" + "sandbox-path" : "/storage/Users/currentUser/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Docs/" }, { - "sandbox-path" : "/storage/External", - "src-path" : "/mnt/data/External" + "sandbox-path" : "/storage/External/", + "src-path" : "/mnt/data/External/" }, { - "sandbox-path" : "/storage/Share", - "src-path" : "/data/service/el1/public/storage_daemon/share/public" + "sandbox-path" : "/storage/Share/", + "src-path" : "/data/service/el1/public/storage_daemon/share/public/" }, { - "sandbox-path" : "/Documents", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Documents" + "sandbox-path" : "/Documents/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Documents/" }, { - "sandbox-path" : "/Download", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Download" + "sandbox-path" : "/Download/", + "src-path" : "/mnt/hmdfs//account/merge_view/files/Download/" } ] } \ No newline at end of file diff --git a/interfaces/innerkits/native/file_uri/src/file_uri.cpp b/interfaces/innerkits/native/file_uri/src/file_uri.cpp index abef75608..f48d6e3d2 100644 --- a/interfaces/innerkits/native/file_uri/src/file_uri.cpp +++ b/interfaces/innerkits/native/file_uri/src/file_uri.cpp @@ -31,6 +31,7 @@ const std::string PATH_SHARE = "/data/storage/el2/share"; const std::string MODE_RW = "/rw/"; const std::string MODE_R = "/r/"; const std::string FILE_SCHEME_PREFIX = "file://"; +const std::string FILE_MANAGER_BASE_PATH = "/storage/Users/"; const std::string FILE_MANAGER_AUTHORITY = "docs"; const std::string MEDIA_AUTHORITY = "media"; string FileUri::GetName() @@ -67,7 +68,7 @@ string FileUri::GetRealPath() string bundleName = uri_.GetAuthority(); LOGD("GetRealPath decode path is %{private}s", sandboxPath.c_str()); if (bundleName == FILE_MANAGER_AUTHORITY && - access(realPath.c_str(), F_OK) == 0) { + access(FILE_MANAGER_BASE_PATH.c_str(), F_OK) == 0) { return realPath; } -- Gitee