From 7461ece530f11763c22af8601f573a0f6ddba65a Mon Sep 17 00:00:00 2001 From: lvyuanyuan Date: Sat, 6 Jan 2024 14:46:41 +0800 Subject: [PATCH] =?UTF-8?q?fileuri=20normalize=E8=BF=94=E5=9B=9E=E5=80=BC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lvyuanyuan Change-Id: Ifde6812cc5deef6a298406133ebde915ff817f05 --- interfaces/kits/js/file_uri/file_uri_n_exporter.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/js/file_uri/file_uri_n_exporter.cpp b/interfaces/kits/js/file_uri/file_uri_n_exporter.cpp index 3c1d0f39e..31cb7f649 100644 --- a/interfaces/kits/js/file_uri/file_uri_n_exporter.cpp +++ b/interfaces/kits/js/file_uri/file_uri_n_exporter.cpp @@ -218,7 +218,16 @@ napi_value FileUriNExporter::Normalize(napi_env env, napi_callback_info info) NError(EINVAL).ThrowErr(env); return nullptr; } - return NVal::CreateUTF8String(env, NormalizeUri(fileuriEntity->fileUri_.uri_)).val_; + + napi_value uriObj = NClass::InstantiateClass(env, FileUriNExporter::className, + {NVal::CreateUTF8String(env, NormalizeUri(fileuriEntity->fileUri_.uri_)).val_}); + if (!uriObj) { + LOGE("Failed to construct FileUriNExporter."); + NError(E_UNKNOWN_ERROR).ThrowErr(env); + return nullptr; + } + + return uriObj; } napi_value FileUriNExporter::Equals(napi_env env, napi_callback_info info) -- Gitee