2
0

🚑 Move cache control header into the post policy

This commit is contained in:
Baptiste Arnaud
2023-11-02 14:43:49 +01:00
parent bdf9faea78
commit a855d85d04
7 changed files with 5 additions and 6 deletions

View File

@ -31,7 +31,6 @@ export const UploadButton = ({
Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value)
})
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file)
const upload = await fetch(data.presignedUrl, {
method: 'POST',

View File

@ -40,7 +40,6 @@ export const uploadFiles = async ({
Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value)
})
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file)
const upload = await fetch(data.presignedUrl, {
method: 'POST',

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.12",
"version": "0.2.13",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@ -43,7 +43,6 @@ export const uploadFiles = async ({
Object.entries(data.formData).forEach(([key, value]) => {
formData.append(key, value)
})
formData.append('Cache-Control', 'max-age=86400')
formData.append('file', file)
const upload = await fetch(data.presignedUrl, {
method: 'POST',

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.12",
"version": "0.2.13",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.12",
"version": "0.2.13",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -34,6 +34,8 @@ export const generatePresignedPostPolicy = async ({
postPolicy.setKey(filePath)
postPolicy.setBucket(env.S3_BUCKET)
postPolicy.setExpires(new Date(Date.now() + tenMinutes * 1000))
postPolicy.formData['Cache-Control'] = 'max-age=86400'
postPolicy.policy.conditions.push(['eq', '$Cache-Control', 'max-age=86400'])
if (fileType) postPolicy.setContentType(fileType)
return minioClient.presignedPostPolicy(postPolicy)