Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import { ZoomablePreview } from './zoomable-preview'

export const ImagePreview = memo(function ImagePreview({ file }: { file: WorkspaceFileRecord }) {
const source = useFileContentSource()
const serveUrl = source.buildUrl(file.key)
// Version the URL on updatedAt: overwrites keep the same storage key, so an unversioned
// URL would resolve to a previously cached copy instead of the rewritten bytes.
const serveUrl = source.buildUrl(file.key, {
version: Number(new Date(file.updatedAt)) || file.size,
})

return (
<ZoomablePreview className='flex flex-1' contentClassName='h-full w-full'>
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const nextConfig: NextConfig = {
async headers() {
return [
{
source: '/:all*(svg|jpg|jpeg|png|gif|ico|webp|avif|woff|woff2|ttf|eot)',
source: '/((?!api/).*\\.(?:svg|jpg|jpeg|png|gif|ico|webp|avif|woff|woff2|ttf|eot))',
headers: [
{
key: 'Cache-Control',
Expand Down
Loading