From d8774ed7c7b3b94352a1ab9d450fd60f4faec72a Mon Sep 17 00:00:00 2001 From: yzh Date: Fri, 16 Aug 2024 14:51:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=B8=BF=E8=92=99next?= =?UTF-8?q?2=E5=90=8Eurl=5Flauncher=E6=89=93=E5=BC=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=A4=B1=E8=B4=A5=E5=92=8C=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E4=B8=AD=E6=96=87=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yzh --- .../ohos/src/main/ets/components/plugin/UrlLauncher.ets | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets index a2ad29ee5..d1d21f2f4 100644 --- a/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets +++ b/packages/url_launcher/url_launcher_ohos/ohos/src/main/ets/components/plugin/UrlLauncher.ets @@ -161,15 +161,15 @@ export class UrlLauncher implements UrlLauncherApi { // 只支持沙箱路径 launchFile(url: string): boolean { let fileUrl = this.parseUrl(url, UrlLauncher.LAUNCH_TYPE_FILE + '://'); - let filePath = this.context.filesDir + fileUrl; // 将沙箱路径转换为uri - let uriFromPath = fileuri.getUriFromPath(filePath); + let uriFromPath = fileuri.getUriFromPath(fileUrl); + let decodedPath = decodeURIComponent(uriFromPath); Log.d(TAG, 'launchFile:' + fileUrl + ' uriFromPath:' + uriFromPath); let want: Want = { flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, // 配置分享应用的隐式拉起规则 action: 'ohos.want.action.viewData', - uri: uriFromPath, + uri: decodedPath, } this.context.startAbility(want) .then(() => { -- Gitee