From 8e9aca43c481ada8ce3a121991c7c9f81c7cdb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=87=AF=E7=A5=A5?= Date: Wed, 7 Dec 2022 14:51:36 +0800 Subject: [PATCH] remove redundant dependencies, only the media library uri authorization is supported. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 张凯祥 --- interfaces/kits/js/BUILD.gn | 5 +---- interfaces/kits/js/file_share/grant_uri_permission.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index 033e7d0da..2b1c030bd 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 a72593237..3e92ae128 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!"); -- Gitee