# Uploaded zip file is renamed

**URL:** https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654
**Category:** Bug
**Created:** [2017年十一月8日 04:00 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654 "2017-11-08T04:00:35Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![HappyGezim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/happygezim/32/120006_2.png) [@HappyGezim](https://meta.discourse.org/u/HappyGezim)
#### Post date: [2017年十一月8日 04:00 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/1 "2017-11-08T04:00:35Z")

</div>

I uploaded files named `zip-recipes-friend.zip` but when users download the file, it’s name is `<GUID>.zip`.

I’m fairly certain this is new but not 100% sure. Did my installation get compromised or was this a change that actually happened?

If this is an intended behaviour, what’s the reason behind it?

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [2017年十一月8日 04:32 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/2 "2017-11-08T04:32:50Z")

</div>

This is indeed a bug,

> [@Upload file name not kept on download](https://meta.discourse.org/t/upload-file-name-not-kept-on-download/71184):
>
> When downloading uploaded files, the file name is not being set when downloaded. This file was originally named ilovepie.txt, but is downloading with a random name. [ilovepie.txt](https://global.discourse-cdn.com/meta/original/3X/e/a/ea79f5d0354286fa7bde1bbd268c905c33a6b086.txt) (11 Bytes) Edit: file name is maintained on Meta, but fails on Try and Stonehearth.

and it should have been fixed by @zogstrip!

> [@Upload file name not kept on download](https://meta.discourse.org/t/upload-file-name-not-kept-on-download/71184/23):
>
> Finally pushed a fix We somehow missed the deprecation warnings and it broke when we upgraded to Rails 5.1.

Could you try upgrading your instance to latest and see if the problem persists? ( ~~since this won’t automatically fix the filenames of existing uploads~~ , my bad, misread a followup on the linked topic, see @michaeld’s comment below)

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [2017年十一月8日 05:17 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/3 "2017-11-08T05:17:11Z")

</div>

> [@xrav3nz](#):
>
> since this won’t automatically fix the filenames of existing uploads)

yes it does, this is not about how it’s being stored but what filename is communicated to the browser upon download.

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [2017年十一月8日 05:51 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/4 "2017-11-08T05:51:58Z")

</div>

I do a migration from one forum engine to Discourse and this problem has been following me since beta9 approximately. Seems that only new deployed image is free of the problem of the naming of downloaded files.

Actually, I don’t know where I did a mistake, and how to report this problem right way. I just deployed the latest Discourse image, then migrated attachments from an old forum to the new one via API, then both migrated and new uploaded files are downloaded with `<hash>` in the filename.

I know, my case is specific, therefore my post is just a little confirmation that the problem still persists in some cases.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017年十一月8日 08:03 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/5 "2017-11-08T08:03:47Z")

</div>

Let’s see. Here’s a text file I uploaded called `funky-biscuits.txt`.

[funky-biscuits.txt](https://global.discourse-cdn.com/meta/original/3X/c/a/ca0ddf91a08e2e89e3968c3866db66a498417195.txt) (18 Bytes)

All correct on our end. So you need to update your instance to latest code.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017年十一月8日 08:04 UTC](https://meta.discourse.org/t/uploaded-zip-file-is-renamed/73654/6 "2017-11-08T08:04:23Z")

</div>


