Respond with 404 in ActiveStorage::DiskController#show when file missing
`ActiveStorage::DiskController#show` generates a 404 Not Found response when the requested file is missing from the disk service. It previously raised `Errno::ENOENT`.
This commit is contained in:
parent
5cd2d07bdc
commit
22efb2ec49
@ -1,3 +1,9 @@
|
||||
* `ActiveStorage::DiskController#show` generates a 404 Not Found response when
|
||||
the requested file is missing from the disk service. It previously raised
|
||||
`Errno::ENOENT`.
|
||||
|
||||
*Cameron Bothner*
|
||||
|
||||
* `ActiveStorage::Blob#download` and `ActiveStorage::Blob#open` raise
|
||||
`ActiveStorage::FileNotFoundError` when the corresponding file is missing
|
||||
from the storage service. Services translate service-specific missing object
|
||||
|
@ -13,6 +13,8 @@ def show
|
||||
else
|
||||
head :not_found
|
||||
end
|
||||
rescue Errno::ENOENT
|
||||
head :not_found
|
||||
end
|
||||
|
||||
def update
|
||||
|
@ -31,6 +31,14 @@ class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal " worl", response.body
|
||||
end
|
||||
|
||||
test "showing blob that does not exist" do
|
||||
blob = create_blob
|
||||
blob.delete
|
||||
|
||||
get blob.service_url
|
||||
assert_response :not_found
|
||||
end
|
||||
|
||||
|
||||
test "directly uploading blob with integrity" do
|
||||
data = "Something else entirely!"
|
||||
|
Loading…
Reference in New Issue
Block a user