mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
small table rename bug, files updates not persisting
This commit is contained in:
@@ -111,6 +111,7 @@ async function handleLocalFile(filename: string, userId: string): Promise<NextRe
|
||||
buffer: fileBuffer,
|
||||
contentType,
|
||||
filename,
|
||||
cacheControl: contextParam === 'workspace' ? 'private, no-cache, must-revalidate' : undefined,
|
||||
})
|
||||
} catch (error) {
|
||||
logger.error('Error reading local file:', error)
|
||||
@@ -172,6 +173,7 @@ async function handleCloudProxy(
|
||||
buffer: fileBuffer,
|
||||
contentType,
|
||||
filename: originalFilename,
|
||||
cacheControl: context === 'workspace' ? 'private, no-cache, must-revalidate' : undefined,
|
||||
})
|
||||
} catch (error) {
|
||||
logger.error('Error downloading from cloud storage:', error)
|
||||
|
||||
@@ -21,6 +21,7 @@ export interface FileResponse {
|
||||
buffer: Buffer
|
||||
contentType: string
|
||||
filename: string
|
||||
cacheControl?: string
|
||||
}
|
||||
|
||||
export class FileNotFoundError extends Error {
|
||||
@@ -256,7 +257,7 @@ export function createFileResponse(file: FileResponse): NextResponse {
|
||||
headers: {
|
||||
'Content-Type': contentType,
|
||||
'Content-Disposition': `${disposition}; ${encodeFilenameForHeader(file.filename)}`,
|
||||
'Cache-Control': 'public, max-age=31536000',
|
||||
'Cache-Control': file.cacheControl || 'public, max-age=31536000',
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'Content-Security-Policy': "default-src 'none'; style-src 'unsafe-inline'; sandbox;",
|
||||
},
|
||||
|
||||
@@ -540,6 +540,9 @@ export function Table({
|
||||
if (!el) return
|
||||
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
const tag = (e.target as HTMLElement).tagName
|
||||
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return
|
||||
|
||||
const anchor = selectionAnchorRef.current
|
||||
if (!anchor || editingCellRef.current || editingEmptyCellRef.current) return
|
||||
|
||||
|
||||
@@ -62,8 +62,8 @@ export function useWorkspaceFiles(workspaceId: string) {
|
||||
* Fetch file content as text via the serve URL
|
||||
*/
|
||||
async function fetchWorkspaceFileContent(key: string, signal?: AbortSignal): Promise<string> {
|
||||
const serveUrl = `/api/files/serve/${encodeURIComponent(key)}?context=workspace`
|
||||
const response = await fetch(serveUrl, { signal })
|
||||
const serveUrl = `/api/files/serve/${encodeURIComponent(key)}?context=workspace&t=${Date.now()}`
|
||||
const response = await fetch(serveUrl, { signal, cache: 'no-store' })
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch file content')
|
||||
|
||||
Reference in New Issue
Block a user