Release team space after update image [SCI-3299] (#1656)

* Release team space after update image
This commit is contained in:
aignatov-bio 2019-04-11 09:20:05 +02:00 committed by GitHub
parent cfbb2a83a6
commit 9377628f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,11 +152,14 @@ class AssetsController < ApplicationController
def update_image
@asset = Asset.find(params[:id])
orig_file_size = @asset.file_file_size
orig_file_name = @asset.file_file_name
return render_403 unless can_read_team?(@asset.team)
@asset.file = params[:image]
@asset.file_file_name = orig_file_name
@asset.save!
# release previous image space
@asset.team.release_space(orig_file_size)
# Post process file here
@asset.post_process_file(@asset.team)