fix banana: remove dead code which strangely reappeared, probably with some rebasing

This commit is contained in:
mlorb 2017-12-05 17:55:09 +01:00
parent ccc2451494
commit a3a494c3a2
2 changed files with 0 additions and 63 deletions

View file

@ -11,31 +11,8 @@ class AssetsController < ApplicationController
before_action :load_vars
before_action :check_read_permission, except: :file_present
before_action :load_vars, except: :signature
before_action :check_read_permission, except: [:signature, :file_present]
before_action :check_edit_permission, only: :edit
# Validates asset and then generates S3 upload posts, because
# otherwise untracked files could be uploaded to S3
def signature
respond_to do |format|
format.json {
asset = Asset.new(asset_params)
if asset.valid?
posts = generate_upload_posts asset
render json: {
posts: posts
}
else
render json: {
status: 'error',
errors: asset.errors
}, status: :bad_request
end
}
end
end
def file_present
respond_to do |format|
format.json do
@ -160,45 +137,6 @@ class AssetsController < ApplicationController
end
end
def generate_upload_posts(asset)
posts = []
s3_post = S3_BUCKET.presigned_post(
key: asset.file.path[1..-1],
success_action_status: '201',
acl: 'private',
storage_class: "STANDARD",
content_length_range: 1..Constants::FILE_MAX_SIZE_MB.megabytes,
content_type: asset.file_content_type
)
posts.push({
url: s3_post.url,
fields: s3_post.fields
})
condition = %r{^image/#{Regexp.union(Constants::WHITELISTED_IMAGE_TYPES)}}
if condition === asset.file_content_type
asset.file.options[:styles].each do |style, option|
s3_post = S3_BUCKET.presigned_post(
key: asset.file.path(style)[1..-1],
success_action_status: '201',
acl: 'public-read',
storage_class: "REDUCED_REDUNDANCY",
content_length_range: 1..Constants::FILE_MAX_SIZE_MB.megabytes,
content_type: asset.file_content_type
)
posts.push({
url: s3_post.url,
fields: s3_post.fields,
style_option: option,
mime_type: asset.file_content_type
})
end
end
posts
end
def append_wd_params(url)
wd_params = ''
params.keys.select { |i| i[/^wd.*/] }.each do |wd|

View file

@ -484,7 +484,6 @@ Rails.application.routes.draw do
get 'files/:id/preview', to: 'assets#preview', as: 'preview_asset'
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
post 'asset_signature' => 'assets#signature'
devise_scope :user do
get 'avatar/:id/:style' => 'users/registrations#avatar', as: 'avatar'