Sha256: e8ebd651286538aad3b66c36a15ea55b495ae52fa2da717f2268b04bb41211e3

Contents?: true

Size: 698 Bytes

Versions: 5

Compression:

Stored size: 698 Bytes

Contents

class PresignedPostsController < ApplicationController
  def new
    @post = Post.new
  end

  def create
    @post = Post.new(params.require(:post).permit(:title, :document_cache_id))

    if @post.save
      redirect_to [:normal, @post]
    else
      render :new
    end
  end

  def upload
    if params[:token] == "xyz123"
      if params[:file].size < 100
        File.open(File.join(Refile.backends["limited_cache"].directory, params[:id]), "wb") do |file|
          file.write(params[:file].read)
        end
        render text: "token accepted"
      else
        render text: "too large", status: 413
      end
    else
      render text: "token rejected", status: 403
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
refile-0.3.0 spec/refile/test_app/app/controllers/presigned_posts_controller.rb
refile-0.2.5 spec/refile/test_app/app/controllers/presigned_posts_controller.rb
refile-0.2.4 spec/refile/test_app/app/controllers/presigned_posts_controller.rb
refile-0.2.3 spec/refile/test_app/app/controllers/presigned_posts_controller.rb
refile-0.2.2 spec/refile/test_app/app/controllers/presigned_posts_controller.rb