diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 033e7d0da7831fc94faa46d33321766f94fb2de6..2b1c030bd3c6c55ef9964bbf0f6f78c665b898eb 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -53,15 +53,12 @@ ohos_shared_library("fileshare") { ] external_deps = [ - "ability_base:want", "ability_base:zuri", - "ability_runtime:ability_manager", "ability_runtime:abilitykit_native", - "ability_runtime:napi_base_context", - "ability_runtime:static_subscriber_extension", "c_utils:utils", "data_share:datashare_common", "data_share:datashare_consumer", + "file_api:remote_uri_native", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", ] diff --git a/interfaces/kits/js/file_share/grant_uri_permission.cpp b/interfaces/kits/js/file_share/grant_uri_permission.cpp index a725932379c1de295da3d23f3fd53e7d518655b7..3e92ae128e8a1592a63c2e903209c51915b99e06 100644 --- a/interfaces/kits/js/file_share/grant_uri_permission.cpp +++ b/interfaces/kits/js/file_share/grant_uri_permission.cpp @@ -16,8 +16,8 @@ #include "file_share_log.h" #include "datashare_helper.h" #include "datashare_values_bucket.h" -#include "napi_base_context.h" #include "ability.h" +#include "remote_uri.h" using namespace OHOS::DataShare; using namespace OHOS::FileManagement::LibN; @@ -60,6 +60,12 @@ namespace ModuleFileShare { return nullptr; } + if (!DistributedFS::ModuleRemoteUri::RemoteUri::IsMediaUri(path.get())) { + LOGE("FileShare::GetJSArgs path parameter format error!"); + NError(EINVAL).ThrowErr(env); + return nullptr; + } + auto [succBundleName, bundleName, lenBundleName] = NVal(env, funcArg[NARG_POS::SECOND]).ToUTF8String(); if (!succBundleName) { LOGE("FileShare::GetJSArgs get bundleName parameter failed!");