Merge pull request #324 from kubet/feat/attachment-rework

fix: try load files if there is no token
This commit is contained in:
Marko Kraemer 2025-05-15 13:16:15 +02:00 committed by GitHub
commit 90a284a14f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 13 deletions

View File

@ -234,14 +234,6 @@ export function FileViewerModal({
loadingFileRef.current = file.path;
try {
// Check if we have a valid session token
if (!session?.access_token) {
throw new Error('Authentication token missing. Please refresh the page and login again.');
}
// Start timer for performance logging
const startTime = performance.now();
// For PDFs and Office documents, always use blob content type
const contentType = isPdfFile || isOfficeFile ? 'blob' : FileCache.getContentTypeFromPath(file.path);
@ -254,14 +246,11 @@ export function FileViewerModal({
{
contentType: contentType as 'text' | 'blob' | 'json',
force: isPdfFile, // Force refresh for PDFs to ensure we get a blob
token: session.access_token,
token: session?.access_token,
}
);
const loadTime = Math.round(performance.now() - startTime);
console.log(
`[FILE VIEWER] Received content for ${file.path} in ${loadTime}ms (${typeof content})`,
);
// Critical check: Ensure the file we just loaded is still the one selected
if (loadingFileRef.current !== file.path) {