Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@dcc @Darbzilla @Doll @coolboymew @echo @shadowferret
> Most people seems to not like haveing named files......
90% of the time I don't care that this happens but especially for music and music videos, it's nice to have that information in the filename.
> talking about that how do you make pleroma reuse the same file if you upload it again.
Pleroma by default nowadays just hashes them. Baest had set it up so that the name stayed in the "?name=" section and then had nginx set the Content-Disposition the same way FSE did, so you'd get the original filename if it was set. It's a one-liner in nginx:
:mycomputer: add_header Content-Disposition "filename=\"$arg_name\"";
I solved the problem by putting them into venti (so it would dedup at the block level instead of just the whole file), and subsequently into Revolver (which copied venti's approach).
Two tasks down the stack, I'm going to get back on the Elixir thing and the URLs are going to look like /media/$longass_sha256?name=$filename with the header set to `Content-Disposition: filename="$filename"`. It's actually done on the Revolver side, I just need to argue with Elixir a while. The relevant part of the code is longer than in nginx but still trivial:
:mycomputer: q := r.URL.Query()
if q.Has("name") {
:mycomputer: w.Header().Set("Content-Disposition", fmt.Sprintf("filename=%q", q.Get("name")))
:mycomputer: }
At some point I will look up the rules for what can appear in the filename string (I think normal escapes won't work so probably I end up doing a regex that just strips everything that is a pain in the ass, but you have to look it up because browsers will just do *whatever*).