aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/test/models/blob_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add ActiveStorage::Blob.unattached scopefatkodima2018-02-121-0/+17
|
* Fix `blob.service_url` for supports string or nil `:filename` option.Jason Lee2018-02-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - Make sure `blob.service_url` present a `ActiveStorage::Filename` type to `serivce.url`. - Add `ActiveStorage::Filename.wrap` method. before: ```rb blob.service_url(filename: ActiveStorage::Filename.new("new.txt")) blob.service_url(filename: "new.txt") => NoMethodError: undefined method `parameters' for "new.txt":String params = {} blob.service_url(filename: params[:filename]) => NoMethodError: undefined method `parameters' for nil:NilClass ``` after: ```rb blob.service_url(filename: "new.txt") blob.service_url(filename: nil) ```
* Allow `ActiveStorage::Blob#service_url` to pass addition options to ↵Jason Lee2018-02-011-0/+20
| | | | | | | | | | | | | | | | | | | | | | | `service.url`. Because there have some service needs more parameters for file URL: https://www.alibabacloud.com/help/doc-detail/44687.htm ```rb class AliyunService < Service def url(key, options = {}) image_process = options[:oss_process] || "image/resize,w_800" "http://image-demo.oss-cn-hangzhou.aliyuncs.com/example.jpg?x-oss-process=#{image_process}" end end ``` Use case: ```erb <%= image_tag @user.avatar.service_url(oss_process: "image/resize,m_fill,h_100,w_100" %> ```
* Add a test for ActiveStorage::Blob#image? and ActiveStorage::Blob#video?Shuhei Kitagawa2018-01-291-0/+12
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-2/+2
|
* Extract content types from blob dataGeorge Claghorn2018-01-151-1/+11
|
* Allow overriding filename in `Blob#service_url`Rosa Gutierrez2018-01-081-3/+14
| | | | | | | This is useful when we have several representations for the same underlying file, each one with a different name, and we need to provide a custom download URL based on that name and not that of the underlying file.
* Force content disposition to attachment for specific content typesRosa Gutierrez2018-01-051-0/+9
| | | | | | | | | | | | | | In this way we avoid HTML, XML, SVG and other files that can be rendered by the browser to be served inline by default. Depending on the origin from where these files are served, this might lead to XSS vulnerabilities, and in the best case, to more realistic phishing attacks and open redirects. We force it rather than falling back to it when other disposition is not provided. Otherwise it would be possible for someone to force inline just by passing `disposition=inline` in the URL. The list of content types to be served as attachments is configurable.
* Purge variants with their blobsGeorge Claghorn2017-12-021-1/+9
|
* Encode Content-Disposition filenames according to RFC 2231George Claghorn2017-08-211-1/+1
| | | | Closes #30134.
* DRYGeorge Claghorn2017-08-201-1/+1
|
* Add missing test for Blob#purgeJon Moss2017-08-171-0/+7
|
* Use frozen string literal in Active StorageKoichi ITO2017-08-121-0/+2
|
* Add 'activestorage/' from commit '3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58'Rafael Mendonça França2017-07-311-0/+47
git-subtree-dir: activestorage git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6 git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58