Class: SolidStorage::FilesController
- Inherits:
-
ActiveStorage::DiskController
- Object
- ActiveStorage::DiskController
- SolidStorage::FilesController
- Includes:
- ActiveStorage::FileServer
- Defined in:
- app/controllers/solid_storage/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/solid_storage/files_controller.rb', line 6 def show if key = decode_verified_key service = named_disk_service(key[:service_name]) @file = service.find(key[:key]) response.headers["Cache-Control"] = service.cache_control if service.cache_control serve_file @file.tempfile, content_type: key[:content_type], disposition: key[:disposition] else head :not_found end end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/solid_storage/files_controller.rb', line 18 def update if token = decode_verified_token if acceptable_content?(token) named_disk_service(token[:service_name]).upload token[:key], request.body, checksum: token[:checksum] head :no_content else head :unprocessable_entity end else head :not_found end rescue ActiveStorage::IntegrityError head :unprocessable_entity end |