| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
Trying to pass the current request down to the service so that it can
create full urls instead of paths makes the API messy so use a model
based on ActiveSupport::CurrentAttributes to provide the current host
to services that need it (primarily the disk service).
|
|
|
|
|
|
|
|
|
|
| |
Addresses rails/rails#32247
Add test that checks identify and analyze work in correct order
Break out direct upload test helper
Review changes for direct-upload test helper
|
| |
|
| |
|
|
|
|
| |
[Matt Jones & George Claghorn]
|
|
|
|
| |
Fixes #32129.
|
| |
|
| |
|
|
|
|
| |
Closes #32096.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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)
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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" %>
```
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Permit creating a record and attaching files in a single step.
# Before:
User.create!(user_params.except(:avatar)).tap do |user|
user.avatar.attach(user_params[:avatar])
end
# After:
User.create!(user_params)
[Yoshiyuki Hirano & George Claghorn]
|
|
|
|
| |
Closes #31164.
|
|
|
|
| |
Due to https://github.com/rack-test/rack-test/commit/5fd3631078e7c73aaed7d4371f70fb2a79384be9.
|
| |
|
|
|
|
| |
Closes #31138.
|
| |
|
| |
|
|
|
|
|
|
|
| |
If a variant has a large set of options associated with it, the generated
filename will be too long, causing Errno::ENAMETOOLONG to be raised. This
change replaces those potentially long filenames with a much more compact
SHA256 hash. Fixes #30662.
|
| |
|
|
|
|
|
| |
* For avoiding N+1 problem, added `with_attached_*` scope to
`has_one_attached` macro.
|
| |
|
|
|
|
| |
Closes #30134.
|
| |
|
| |
|
| |
|
|
|
|
| |
ActiveStorage::Filename is a model, so its test case belongs in test/models.
|
| |
|
| |
|
|
|
|
| |
ActionDispatch::Http::UploadedFile
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This fixes following warnings:
```
test/models/variant_test.rb:11: warning: ambiguous first argument; put parentheses or a space even after `/' operator
lib/active_storage/attached/macros.rb:63: warning: instance variable @active_storage_attached_highlights not initialized
lib/active_storage/attached/macros.rb:25: warning: instance variable @active_storage_attached_avatar not initialized
```
|
|
git-subtree-dir: activestorage
git-subtree-mainline: 0d58e7e478e79c2d6b2a39a4444d2a17a903b2a6
git-subtree-split: 3f4a7218a4a4923a0e7ce1b2eb0d2888ce30da58
|