From 9377628f5ea490576892a1b9ccdc3bf48471fc1e Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Thu, 11 Apr 2019 09:20:05 +0200 Subject: [PATCH] Release team space after update image [SCI-3299] (#1656) * Release team space after update image --- app/controllers/assets_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index dc1c9911e..8ec571941 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb @@ -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)