Module: Fiona7::BinaryHandling::DeliveryMixin
- Defined in:
- lib/fiona7/scrivito_patches/binary.rb
Instance Method Summary collapse
-
#query ⇒ Object
HEAD.
-
#show ⇒ Object
GET.
Instance Method Details
#query ⇒ Object
HEAD
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/fiona7/scrivito_patches/binary.rb', line 297 def query binary_id = binary_id_from_params transformation = transformation_from_params = BinaryHandling::MetaBinary.new(binary_id, transformation) if !.valid? bad_request elsif !.present? not_found else simple_set_header('Content-Type', .mime_type) simple_set_header('Content-Length', .length) simple_set_header('Cache-Control', 'no-transform,public,max-age=300,s-maxage=900') head_ok end end |
#show ⇒ Object
GET
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/fiona7/scrivito_patches/binary.rb', line 268 def show binary_id = binary_id_from_params transformation = transformation_from_params = MetaBinary.new(binary_id, transformation) if !.present? if Fiona7.mode == :standalone && (current_binary = get_current_binary_url(binary_id)) Rails.logger.info("Redirect to #{current_binary}") redirect_to current_binary, status: 301 else not_found end elsif !.valid? bad_request elsif stale?(:last_modified => .last_changed) && true filename = .filename filepath = .filepath mime_type = .mime_type send_file(File.(filepath), { :type => mime_type, :filename => filename, :disposition => 'inline' }) end end |