Skip to content

Commit

Permalink
fix(opener): invoke the mobile plugin in the commands too (#2234) (#2332
Browse files Browse the repository at this point in the history
)

Co-authored-by: Fabian-Lars <github@fabianlars.de>
  • Loading branch information
betamos and FabianLars authored Jan 19, 2025
1 parent 125ec1d commit 5b82118
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/opener-mobile-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"opener": patch
"opener-js": patch
---

Fix broken JS commands `opener.openPath` and `opener.openUrl` on mobile.
6 changes: 3 additions & 3 deletions plugins/opener/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tauri::{
AppHandle, Runtime,
};

use crate::{scope::Scope, Error};
use crate::{scope::Scope, Error, OpenerExt};

#[tauri::command]
pub async fn open_url<R: Runtime>(
Expand All @@ -34,7 +34,7 @@ pub async fn open_url<R: Runtime>(
);

if scope.is_url_allowed(&url, with.as_deref()) {
crate::open_url(url, with)
app.opener().open_url(url, with)
} else {
Err(Error::ForbiddenUrl { url, with })
}
Expand Down Expand Up @@ -63,7 +63,7 @@ pub async fn open_path<R: Runtime>(
);

if scope.is_path_allowed(Path::new(&path), with.as_deref())? {
crate::open_path(path, with)
app.opener().open_path(path, with)
} else {
Err(Error::ForbiddenPath { path, with })
}
Expand Down

0 comments on commit 5b82118

Please sign in to comment.