fix: Download Token-Fehler - Token als Query-Parameter unterstuetzen

Problem: window.location.href sendet keinen Authorization-Header,
daher scheiterten alle direkten Downloads (Dateien + Ordner-ZIP)
mit 'Token fehlt'.

Loesung:
- Backend: token_required akzeptiert jetzt auch ?token=... als
  Query-Parameter (Fallback wenn kein Authorization-Header)
- Frontend: downloadUrl() haengt den Access-Token automatisch als
  Query-Parameter an die Download-URL an

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stefan Hacker
2026-04-11 20:39:58 +02:00
parent ed1a619ad1
commit 1ee80e650d
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import apiClient from '../api/client'
import { useAuthStore } from './auth'
export const useFilesStore = defineStore('files', () => {
const files = ref([])
@@ -72,7 +73,8 @@ export const useFilesStore = defineStore('files', () => {
}
function downloadUrl(fileId) {
return `/api/files/${fileId}/download`
const auth = useAuthStore()
return `/api/files/${fileId}/download?token=${encodeURIComponent(auth.accessToken || '')}`
}
return {