mirror of https://github.com/kortix-ai/suna.git
Merge pull request #324 from kubet/feat/attachment-rework
fix: try load files if there is no token
This commit is contained in:
commit
90a284a14f
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue