diff options
author | Stan Hu <stanhu@gmail.com> | 2018-10-10 22:15:56 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-10-10 23:24:06 +0300 |
commit | fbb5953ec36ae3e53f9a07f5a0d1cf1b5e1ef209 (patch) | |
tree | 83045ae3ed3a36c35594b42bae665b10c25056de /app | |
parent | 2efbc75fd427678a6a0b9910d1ba13f9065557ea (diff) |
Fix project deletion when there is a export available
Project deletions were failing with "Can't modify frozen hash" because:
1. Project#remove_exports was called in the after_destroy hook
2. This would remove the file and update ImportExportUpload
3. ImportExportUpload#save would attempt to write to a destroyed model
To avoid this, we just check if ImportExportUpload has been destroyed
before attempting to save it.
This would have a side effect of not running after_commit hooks to delete the
repository on disk, making it impossible to delete the project entirely.
Closes #52362
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 05e14c578b5..c7ca322853f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1789,7 +1789,7 @@ class Project < ActiveRecord::Base return unless export_file_exists? import_export_upload.remove_export_file! - import_export_upload.save + import_export_upload.save unless import_export_upload.destroyed? end def export_file_exists? |