Sha256: 1ee9bbae98b664d580d31e68fa69b87125d4ac73f4811627016844a6d58eeca7

Contents?: true

Size: 708 Bytes

Versions: 5

Compression:

Stored size: 708 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
        raise e
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scrivito_sdk-0.70.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.70.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.66.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.66.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-0.66.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb