# S3 CDN URL not being used on non-image uploads

**URL:** https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332
**Category:** Bug
**Created:** [January 7, 2021, 1:24am UTC](https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332 "2021-01-07T01:24:44Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![elle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elle/32/119940_2.png) [@elle](https://meta.discourse.org/u/elle)
#### Post date: [January 23, 2022, 4:12pm UTC](https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332/9 "2022-01-23T16:12:23Z")

</div>

Ok so I found the place where [Markdown for attachments is generated](https://github.com/discourse/discourse/blob/v2.8.0.beta11/app/assets/javascripts/discourse/app/lib/uploads.js#L269) and as far as I understand the plugin API one cannot (easily) override it (I even think one should not do it).

So my initial thought of adding a `?dl=1` param to those urls seems like the wrong way to do it.

Regarding not-forcing downloads for resolved short-urls: If I understand [the argument against public ACLs on S3 buckets](https://meta.discourse.org/t/s3-cdn-url-ignored-when-uploading-into-posts/54898/4) correctly, one should either:

1. serve files from S3 via a CDN (unfeasible for attachments as @martin pointed, as we may not be able to correctly set the filename for download in this case)
2. create a presigned url for the S3 object

But the current behavior does neither and expects the S3 bucket to have a public ACL. This also seems to be the case for supported S3 providers (including amazon), so I’d ask why not make the [force\_download option in `Discourse.store.url_for` default to true](https://github.com/discourse/discourse/blob/v2.8.0.beta11/app/controllers/uploads_controller.rb#L121) when resolving short-urls for S3 stores?

---

_[View the full topic](https://meta.discourse.org/t/s3-cdn-url-not-being-used-on-non-image-uploads/175332)._
