AOSSIE-Org / AOSSIE-Org/PictoPy

Fix: “Open Original File” button not working in Image Details panel

未关闭
#688 4 条评论 0 个 reaction 已指派 1 人 已被 @NikhilPatil2005 认领 在 GitHub 查看
bug frontend
主要语言
Python
星标
283
派生
679
平均合并
7 天 2 小时
30 天内合并 PR
3

描述

**Summary :**
The “Open Original File” button inside the Image Details panel is currently not working.
When the user clicks this button, nothing happens.

**Problem Details :**
This issue occurs due to the following reasons:
1. The frontend was using `@tauri-apps/plugin-shell`, which only supports opening URLs, not local file system paths.
2. There was no Tauri backend command to handle local file opening.
3. Tauri v2 removed the older `tauri::api::shell::open` API, so the existing logic is outdated and does not work.

Because of this, the app cannot open the selected image using the system's default file viewer.
Proposed Fix (Tested Locally)

**Proposed Fix (Tested Locally)**
**1. Added a new Tauri command in Rust**
```rust
#[tauri::command]
async fn open_original_file(path: String) -> Result<(), String> {
tauri_plugin_opener::open_path(path, None::)
.map_err(|e| e.to_string())
}
And registered it:
.invoke_handler(tauri::generate_handler![
services::get_server_path,
open_original_file
])

**2.Updated the frontend to call this command :**
import { invoke } from "@tauri-apps/api/core";
await invoke("open_original_file", { path: currentImage.path });

**Result :**
After applying this fix:
The button now successfully opens the original image file.
It works across Windows, macOS, and Linux.
The fix integrates properly with Tauri v2 and uses tauri-plugin-opener, which is the recommended approach.

**Why I am opening this issue ?**
I found this bug while using the app and have implemented the fix locally.
I would like to work on this issue and raise a PR for it.

**Please assign this issue to me.**

**Before fix:**
Image

**After fix:**

Image

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。