AOSSIE-Org / AOSSIE-Org/PictoPy
Fix: “Open Original File” button not working in Image Details panel
- Linguagem predominante
- Python
- Estrelas
- 283
- Forks
- 679
- Merge médio
- 7d 2h
- PRs com merge (30d)
- 3
Descrição
**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:**
**After fix:**
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.