fix: pass path in query to ensure pathjail picks it up, add explicit error handling UI
All checks were successful
Automated Container Build / build-and-push (push) Successful in 39s

This commit is contained in:
Elijah 2026-05-23 14:34:31 -07:00
parent 9807ad6fe5
commit 1a1add48bf
2 changed files with 24 additions and 8 deletions

View file

@ -80,6 +80,14 @@ class ApiClient {
}
}
if (!response.ok && endpoint !== '/api/auth/refresh') {
let errorMsg = `HTTP ${response.status}`;
try {
const errData = await response.clone().json();
if (errData.error) errorMsg = errData.error;
} catch {}
throw new Error(errorMsg);
}
return response;
}
@ -202,7 +210,7 @@ class ApiClient {
}
async deleteFile(path: string, permanent: boolean = false) {
const query = permanent ? '?permanent=true' : '';
const query = permanent ? `?permanent=true&path=${encodeURIComponent(path)}` : `?path=${encodeURIComponent(path)}`;
const res = await this.request(`/api/files/${encodeURIComponent(path)}${query}`, {
method: 'DELETE',
});
@ -278,6 +286,7 @@ class ApiClient {
// --- Pinned ---
async listPinned() {
const res = await this.request('/api/files/pinned');
if (!res.ok) throw await res.json();
return res.json();
}
@ -286,16 +295,19 @@ class ApiClient {
method: 'POST',
body: { path },
});
if (!res.ok) throw await res.json();
return res.json();
}
async getTasks() {
const res = await this.request('/api/tasks');
if (!res.ok) throw await res.json();
return res.json();
}
async getSettings() {
const res = await this.request('/api/settings');
if (!res.ok) throw await res.json();
return res.json();
}