fix: use backend command to read memory files for WSL compatibility
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m23s
CI / Lint & Test (pull_request) Successful in 20m3s
CI / Build Linux (pull_request) Successful in 24m6s
CI / Build Windows (cross-compile) (pull_request) Successful in 34m8s

The frontend was using Tauri's `readTextFile` plugin which enforces
scope restrictions and doesn't work with WSL paths on Windows.

Changed to use our `read_file_content` backend command which:
- Already handles WSL paths correctly on Windows
- Works with absolute paths on all platforms
- Bypasses Tauri's filesystem scope restrictions
- Matches the pattern used throughout the app for file operations

This fixes the "forbidden path" error when trying to read memory
files on Windows whilst maintaining functionality on Linux/Mac.

 This fix was created by Hikari~ 🌸
This commit is contained in:
2026-02-08 12:50:18 -08:00
committed by Naomi Carrigan
parent bd5d7685d8
commit 6f7544c8b3
+2 -2
View File
@@ -1,7 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
import { invoke } from "@tauri-apps/api/core";
import { readTextFile } from "@tauri-apps/plugin-fs";
import Markdown from "./Markdown.svelte";
let memoryFiles: string[] = $state([]);
@@ -33,7 +32,8 @@
isLoading = true;
error = null;
try {
const content = await readTextFile(filePath);
// Use our backend command instead of Tauri plugin to handle WSL paths
const content = await invoke<string>("read_file_content", { path: filePath });
fileContent = content;
selectedFile = filePath;
} catch (e) {