diff --git a/interfaces/common/file_share_sandbox.json b/interfaces/common/file_share_sandbox.json index 7d195ff1d5915048228d00d2bd6b5ba278b3fc8e..8a5b059014e6aad932984962484b24e996330a9a 100644 --- a/interfaces/common/file_share_sandbox.json +++ b/interfaces/common/file_share_sandbox.json @@ -44,12 +44,6 @@ }, { "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" : "/Download/", - "src-path" : "/mnt/hmdfs//account/merge_view/files/Download/" } ] } \ No newline at end of file diff --git a/interfaces/common/src/sandbox_helper.cpp b/interfaces/common/src/sandbox_helper.cpp index 5354e2eb5f3262d10085a189cea62047ff1fd840..4f1b0ae1ae0f72f6ed1a61535dc82e21882c7063 100644 --- a/interfaces/common/src/sandbox_helper.cpp +++ b/interfaces/common/src/sandbox_helper.cpp @@ -37,6 +37,10 @@ namespace { const string SANDBOX_JSON_FILE_PATH = "/etc/app_file_service/file_share_sandbox.json"; const std::string SHAER_PATH_HEAD = "/mnt/hmdfs/"; const std::string SHAER_PATH_MID = "/account/merge_view/files/"; + const string FILE_MANAGER_URI_HEAD = "/storage/"; + const string FILE_MANAGER_AUTHORITY = "docs"; + const string DLP_MANAGER_BUNDLE_NAME = "com.ohos.dlpmanager"; + const string FUSE_URI_HEAD = "/mnt/data/fuse"; const string BACKFLASH = "/"; const string MEDIA = "media"; const int ASSET_IN_BUCKET_NUM_MAX = 1000; @@ -238,6 +242,11 @@ int32_t SandboxHelper::GetPhysicalPath(const std::string &fileUri, const std::st return GetMediaPhysicalPath(sandboxPath, userId, physicalPath); } + 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; + } + string lowerPathTail = ""; string lowerPathHead = "";