Sha256: 8aef49d466699a3e9bb115e07724a90f306eaa5cda8f86b10391a3df0f13b8c2

Contents?: true

Size: 767 Bytes

Versions: 4

Compression:

Stored size: 767 Bytes

Contents

module Scrivito
  class BinaryRedirectController < ApplicationController
    def to_binary
      binary = BinaryParamVerifier.verify(params[:encrypted_params])
      redirect_to BinaryRewrite.call(request, binary.url)
    rescue BinaryParamVerifier::InvalidSignature
      head :precondition_failed
    rescue TransformationSourceError => e
      case e.code
      when 'binary.unprocessable.image.transform.source.type_invalid'
        redirect_to view_context.image_path('scrivito/source_type_invalid.png')
      when 'binary.unprocessable.image.transform.source.too_large'
        redirect_to view_context.image_path('scrivito/source_too_large.png')
      else
        redirect_to view_context.image_path('scrivito/source_invalid.png')
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scrivito_sdk-0.70.2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.70.1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.70.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.70.0.rc3 app/controllers/scrivito/binary_redirect_controller.rb