Skip to content

Commit

Permalink
feat: change image response to preview instead of download
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Feb 24, 2025
1 parent c94513c commit 664d9d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions functions/file/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,15 @@ export async function onRequest(context) {
}
}

return response;

// Create a new response with modified headers for image preview
const newHeaders = new Headers(response.headers);
newHeaders.set('Content-Disposition', 'inline');

return new Response(response.body, {
status: response.status,
statusText: response.statusText,
headers: newHeaders
});
}

async function getFilePath(env, file_id) {
Expand Down

0 comments on commit 664d9d4

Please sign in to comment.