Sha256: ed47ec3f2371cb7fd2264d0ae2b918bb7505fc43fc9d75969c1794e841a43190

Contents?: true

Size: 727 Bytes

Versions: 66

Compression:

Stored size: 727 Bytes

Contents

module Scrivito
  class BinaryRedirectController < ActionController::Base
    def to_binary
      binary = BinaryParamVerifier.verify(params[:encrypted_params])
      redirect_to BinaryRewrite.call(request, binary.url)
    rescue BinaryParamVerifier::InvalidSignature
      head :precondition_failed
    rescue TransformationSourceError => error
      case error.code
      when /transform.source.type_invalid/ then render_error('source_type_invalid')
      when /transform.source.too_large/ then render_error('source_too_large')
      else render_error('source_invalid')
      end
    end

    private

    def render_error(error_name)
      redirect_to view_context.image_path("scrivito/#{error_name}.png")
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
scrivito_sdk-1.6.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.3.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.6.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.2.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.1.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.1.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.5.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.1.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.4.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.3.1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.3.1.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.3.0 app/controllers/scrivito/binary_redirect_controller.rb