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 3c1d0f39ee7e439f4dc9433ea68d20cf31532790..31cb7f649eb7e4b508cecb149e77740fcb31f04b 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)