diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2019-03-04 21:36:34 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2019-03-04 21:36:34 +0300 |
commit | ebf16ada856efb85424a98848c141f21e609886a (patch) | |
tree | e9700c1c392644f035302c61fc8f9c2dc6095a92 /lib | |
parent | adedcb329464783165db2c233b3a6fd9578d2c25 (diff) |
Arbitrary file read via MergeRequestDiff
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/merge_request_parser.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/merge_request_parser.rb b/lib/gitlab/import_export/merge_request_parser.rb index 040a70d6775..deb2f59f05f 100644 --- a/lib/gitlab/import_export/merge_request_parser.rb +++ b/lib/gitlab/import_export/merge_request_parser.rb @@ -20,6 +20,17 @@ module Gitlab create_target_branch unless branch_exists?(@merge_request.target_branch) end + # The merge_request_diff associated with the current @merge_request might + # be invalid. Than means, when the @merge_request object is saved, the + # @merge_request.merge_request_diff won't. This can leave the merge request + # in an invalid state, because a merge request must have an associated + # merge request diff. + # In this change, if the associated merge request diff is invalid, we set + # it to nil. This change, in association with the after callback + # :ensure_merge_request_diff in the MergeRequest class, makes that + # when the merge request is going to be created and it doesn't have + # one, a default one will be generated. + @merge_request.merge_request_diff = nil unless @merge_request.merge_request_diff&.valid? @merge_request end |