Renaming a file but on download it shows the file's key instead of it's name
Main tech stack:
Nextjs
: 15v, Drizzle orm
: 0.39v, Clerk
: 6v, Uploadthing
: 7v.
Github
: https://github.com/webdevkaleem/zip4you
Description:
So when i upload a file, i generate a random name using cuid2
. After upload is completed, a UI pops up where you can rename
the media. This works flawlessly as the new name is updated inside Uploadthing
and Postgres
. The issue is that when i download
the media from the client UI
, it shows the key
instead of the name
for the media.
But
There is one special case where something else happens. I have a tRPC
procedure (/api/trpc/media.gmail) which gets a request
from zapier
and does it's own thing. Here's the catch. When this is procedure runs, it takes the subject
from the header and set that as the file name
. Now when i download the file from the client UI
it shows the name
correctly.
However
In both cases the updated name isn't reflected when i start a download on the client.GitHub
GitHub - webdevkaleem/zip4you: This is an open-source file distribu...
This is an open-source file distributor designed to facilitate file sharing among users without requiring account creation. It’s a simple solution for distributing files quickly and efficiently. - ...
24 Replies
--------------------------------------------------------------------
Uploadthing

After client presses the
download
button
Js Task 3
is the original name
Js Task 3 Rename
is the updated name, and this change isn't shown when a user downloads the file
For reference when i go to the url which i directly copied from the uploadthing
dashboard, it still shows me the original / old file nameyea this has been a low hanging fruit I've been meaning to fix for a while, but just never got around to - surprised noone has brough it up before
lol.
i wanted to invest more into uploadthing so i was playing around
i guess for the time being ill figure smthing out. Its just passion projects for me rn
i can bump it up some priority levels now that someone actually reported it
Solution
got a PR up with a fix
i can't seem to find it
i can't find it on github but yes it all works flawlessly now
thanks
Infra isn’t open source
makes sense
@julius the renaming fix broke
example:


What’s the file key for that file?
HMj016y4l9GSIrbFEDpnORuUyJPDiFxNT23StqHVcvXWwB98
just for context i add a random name upon upload using cuid2
that name is being shown with addition of the "test_" keyword which i forgot to remove
wut

its a zip file
the app lets you zip multiple files together for sharing
this is me testing
I just went to utfs.io/f/HMj016y4l9GSIrbFEDpnORuUyJPDiFxNT23StqHVcvXWwB98
yes and u downloaded the file
the issue is the name of the file which u downloaded, the zip file
Oh right safari auto-decompresses
found the issue - bad merge reverted that chagne for s3 files :/
deploying fix
thank you
it's up

yep. it works now
thanks
sorry for the regression
not at all. it's not like i have any real users 😂