Fix: sidebar drive button resets to root, and use query parameter for downloads to bypass Next.js API rewrite bug with parenthesis in paths
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m23s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m23s
This commit is contained in:
parent
0bd42e5b47
commit
d982ce66a8
3 changed files with 4 additions and 3 deletions
|
|
@ -205,6 +205,7 @@ func main() {
|
||||||
files.Get("/thumbnail/:checksum", fsHandler.ServeThumbnail)
|
files.Get("/thumbnail/:checksum", fsHandler.ServeThumbnail)
|
||||||
files.Get("/download-folder", fsHandler.DownloadFolder)
|
files.Get("/download-folder", fsHandler.DownloadFolder)
|
||||||
files.Post("/download-bulk", fsHandler.DownloadBulk)
|
files.Post("/download-bulk", fsHandler.DownloadBulk)
|
||||||
|
files.Get("/download", fsHandler.Download)
|
||||||
files.Get("/download/*", fsHandler.Download)
|
files.Get("/download/*", fsHandler.Download)
|
||||||
files.Post("/zip", archiveHandler.Zip)
|
files.Post("/zip", archiveHandler.Zip)
|
||||||
files.Post("/unzip", archiveHandler.Unzip)
|
files.Post("/unzip", archiveHandler.Unzip)
|
||||||
|
|
|
||||||
|
|
@ -1433,7 +1433,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-1 px-3 py-4 border-b" style={{ borderColor: 'var(--color-border-subtle)' }}>
|
<div className="flex flex-col gap-1 px-3 py-4 border-b" style={{ borderColor: 'var(--color-border-subtle)' }}>
|
||||||
<button
|
<button
|
||||||
onClick={() => { setAppMode('drive'); setEditingFile(null); setActiveSection('files'); }}
|
onClick={() => { setAppMode('drive'); setEditingFile(null); setActiveSection('files'); navigateTo('.'); }}
|
||||||
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-xl text-sm font-bold transition-all duration-150"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: appMode === 'drive' ? 'var(--color-accent-subtle)' : 'transparent',
|
backgroundColor: appMode === 'drive' ? 'var(--color-accent-subtle)' : 'transparent',
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ class ApiClient {
|
||||||
|
|
||||||
async deleteFile(path: string, permanent: boolean = false) {
|
async deleteFile(path: string, permanent: boolean = false) {
|
||||||
const query = permanent ? `?permanent=true&path=${encodeURIComponent(path)}` : `?path=${encodeURIComponent(path)}`;
|
const query = permanent ? `?permanent=true&path=${encodeURIComponent(path)}` : `?path=${encodeURIComponent(path)}`;
|
||||||
const res = await this.request(`/api/files/${encodeURIComponent(path)}${query}`, {
|
const res = await this.request(`/api/files/${query}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
return res.json();
|
return res.json();
|
||||||
|
|
@ -295,7 +295,7 @@ class ApiClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
getDownloadUrl(path: string, token: string) {
|
getDownloadUrl(path: string, token: string) {
|
||||||
return `${API_BASE}/api/files/download/${encodeURIComponent(path)}?token=${token}`;
|
return `${API_BASE}/api/files/download?path=${encodeURIComponent(path)}&token=${token}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDownloadFolderUrl(path: string, token: string) {
|
getDownloadFolderUrl(path: string, token: string) {
|
||||||
|
|
|
||||||
Reference in a new issue