diff options
Diffstat (limited to 'app/services/files/update_service.rb')
-rw-r--r-- | app/services/files/update_service.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/files/update_service.rb b/app/services/files/update_service.rb index a71fe61a4b6..fbbab97632e 100644 --- a/app/services/files/update_service.rb +++ b/app/services/files/update_service.rb @@ -1,6 +1,6 @@ module Files class UpdateService < Files::BaseService - class FileChangedError < StandardError; end + FileChangedError = Class.new(StandardError) def commit repository.update_file(current_user, @file_path, @file_content, @@ -18,6 +18,10 @@ module Files def validate super + if @file_content.nil? + raise_error("You must provide content.") + end + if file_has_changed? raise FileChangedError.new("You are attempting to update a file that has changed since you started editing it.") end |