Sha256: ce208089ad8b921693d5abc520709ce7a2e78be98d35ad281c91b661dbcd97d9

Contents?: true

Size: 643 Bytes

Versions: 16

Compression:

Stored size: 643 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.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

16 entries across 16 versions & 1 rubygems

Version Path
scrivito_sdk-1.12.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.12.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.12.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.11.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.11.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0.rc5 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0.rc4 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0.rc3 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.10.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.9.1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.9.1.rc1 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.9.0 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.9.0.rc2 app/controllers/scrivito/binary_redirect_controller.rb
scrivito_sdk-1.9.0.rc1 app/controllers/scrivito/binary_redirect_controller.rb