generated from nhcarrigan/template
feat: convert WSL Linux paths to Windows UNC paths when opening binary files
Adds open_binary_file Tauri command that translates WSL Linux-style paths (e.g. /tmp/mcp_output_abc123.pdf) to Windows UNC paths via wslpath -w before opening, so binary file links work correctly on Windows/WSL. Non-Windows platforms pass the path through unchanged. Markdown.svelte now invokes this command instead of calling openPath directly.
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
import { marked } from "marked";
|
||||
import hljs from "highlight.js";
|
||||
import { onMount } from "svelte";
|
||||
import { openUrl, openPath } from "@tauri-apps/plugin-opener";
|
||||
import { openUrl } from "@tauri-apps/plugin-opener";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { clipboardStore } from "$lib/stores/clipboard";
|
||||
import { linkifyFilePaths } from "$lib/utils/filePaths";
|
||||
|
||||
@@ -148,7 +149,7 @@
|
||||
|
||||
const filePath = anchor.dataset.filepath;
|
||||
if (filePath) {
|
||||
void openPath(filePath);
|
||||
void invoke("open_binary_file", { path: filePath });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
* - [ ] Code blocks render with syntax highlighting and a copy button
|
||||
* - [ ] ||spoiler text|| renders as a hidden span revealed on click
|
||||
* - [ ] Search query highlights matching text in non-code content
|
||||
* - [ ] Links open in the system browser via the Tauri opener
|
||||
* - [ ] Regular links open in the system browser via the Tauri opener
|
||||
* - [ ] Binary file links invoke open_binary_file (WSL-path-aware) instead of openPath
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
Reference in New Issue
Block a user