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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user