Skip to content

Commit

Permalink
🚸 (fileUpload) Properly encode commas from uploaded file urls
Browse files Browse the repository at this point in the history
Closes #955
  • Loading branch information
baptisteArno committed Nov 28, 2023
1 parent 8ce4e48 commit 8d413f0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/embeds/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.24",
"version": "0.2.25",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const FileUploadForm = (props: Props) => {
if (urls.length)
return props.onSubmit({
label: `File uploaded`,
value: urls[0] ? encodeURI(urls[0]) : '',
value: urls[0] ? encodeUrl(urls[0]) : '',
})
setErrorMessage('An error occured while uploading the file')
}
Expand Down Expand Up @@ -102,7 +102,7 @@ export const FileUploadForm = (props: Props) => {
return setErrorMessage('An error occured while uploading the files')
props.onSubmit({
label: `${urls.length} file${urls.length > 1 ? 's' : ''} uploaded`,
value: urls.filter(isDefined).map(encodeURI).join(', '),
value: urls.filter(isDefined).map(encodeUrl).join(', '),
})
}

Expand Down Expand Up @@ -278,3 +278,10 @@ const FileIcon = () => (
<polyline points="13 2 13 9 20 9" />
</svg>
)

const encodeUrl = (url: string): string => {
const fileName = url.split('/').pop()
if (!fileName) return url
const encodedFileName = encodeURIComponent(fileName)
return url.replace(fileName, encodedFileName)
}
2 changes: 1 addition & 1 deletion packages/embeds/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.24",
"version": "0.2.25",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/embeds/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.24",
"version": "0.2.25",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

3 comments on commit 8d413f0

@vercel
Copy link

@vercel vercel bot commented on 8d413f0 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 8d413f0 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 8d413f0 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

triprint.my
wolf.cr8.ai
ai.meant.com
alphamen.pro
bet7k.online
bot.afric.ai
bot.grace.bj
bot.contakit.com
bot.imovfast.com
bot.lafabri.link
bot.neobank.tech
bot.piccinato.co
bot.synclab.help
chat.sifucrm.com
chat.syncwin.com
chatonlineja.com
clo.closeer.work
cockroach.cr8.ai
codigoslucre.com
demo.chatjer.com
desafioem21d.com
digitando.online
faqs.nigerias.io
feiraodehoje.com
georgemarttt.com
go.chatbotcv.com
guiascore900.com
haymanevents.com
kw.wpwakanda.com
localamor.online
lojamundobox.com
my.skillbrow.com
myrentalhost.com
nadieralatif.com
next-contato.com
pray.jetdigi.com
ren.aarealtor.co
serasa-score.com
silvercop.com.br
silvercop.online
stan.vselise.com
typebot.aloe.bot
vidalimentar.com
voicehelp.cr8.ai
web.bjogador.com
web.drrichbr.com
webwhatsapp.work
whatisappweb.com
wts.aarealtor.co
www.pantaflow.ai
zap.fundviser.in
acordocorreto.com
akses.sifucrm.com
analistamines.com
app.bouclidom.com
viewer-v2-typebot-io.vercel.app
mdb.assessoria.aloisio.progenbr.com
mdb.assessoria.girotto.progenbr.com
mdb.assessoria.marinho.progenbr.com
mdb.assessoria.rodrigo.progenbr.com
register.thailandmicespecialist.com
mdb.assessoria.desideri.progenbr.com
mdb.assessoria.fernanda.progenbr.com
mdb.assessoria.jbatista.progenbr.com
mdb.assessoria.mauricio.progenbr.com
mdb.evento.autocadastro.progenbr.com
form.shopmercedesbenzsouthorlando.com
mdb.evento.equipeinterna.progenbr.com
bot.studiotecnicoimmobiliaremerelli.it
mdb.assessoria.boaventura.progenbr.com
mdb.assessoria.jtrebesqui.progenbr.com
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
gabinete.baleia.formulario.progenbr.com
mdb.assessoria.carreirinha.progenbr.com
chrome-os-inquiry-system.itschromeos.com
mdb.assessoria.paulomarques.progenbr.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com
mdb.assessoria.qrcode.ademir.progenbr.com
mdb.assessoria.qrcode.arthur.progenbr.com
mdb.assessoria.qrcode.danilo.progenbr.com
mdb.assessoria.qrcode.marcao.progenbr.com
mdb.assessoria.qrcode.marcio.progenbr.com
mdb.assessoria.qrcode.aloisio.progenbr.com
mdb.assessoria.qrcode.girotto.progenbr.com
mdb.assessoria.qrcode.marinho.progenbr.com
mdb.assessoria.qrcode.rodrigo.progenbr.com
mdb.assessoria.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.desideri.progenbr.com
mdb.assessoria.qrcode.fernanda.progenbr.com
mdb.assessoria.qrcode.jbatista.progenbr.com
mdb.assessoria.qrcode.mauricio.progenbr.com
mdb.assessoria.fernanda.regional.progenbr.com
mdb.assessoria.qrcode.boaventura.progenbr.com
mdb.assessoria.qrcode.jtrebesqui.progenbr.com
mdb.assessoria.qrcode.carreirinha.progenbr.com
mdb.assessoria.qrcode.paulomarques.progenbr.com
mdb.assessoria.qrcode.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.fernanda.regional.progenbr.com

Please sign in to comment.