-
- Downloads
There was an error fetching the commit references. Please try again later.
Fix moving issues API failing when text includes commit URLs
When a issue is moved from one project to another, all associated Markdown text is rewritten in the context of the new project. If the note contained a link to a commit URL, `CommitRewriter#rewrite` would fail because `Commit#link_reference_pattern` would match `nil` `commit` values in the HTML generated from the Markdown. These `nil` values were passed along to `Project#commits_by` because `Commit#reference_valid?` was always returning `true`. To prevent this issue from happening, we tighten up the check for `Commit#reference_valid?` to look for valid SHA values. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66666
Showing
- app/models/commit.rb 6 additions, 1 deletionapp/models/commit.rb
- changelogs/unreleased/sh-fix-issue-move-api.yml 5 additions, 0 deletionschangelogs/unreleased/sh-fix-issue-move-api.yml
- spec/lib/gitlab/gfm/reference_rewriter_spec.rb 17 additions, 0 deletionsspec/lib/gitlab/gfm/reference_rewriter_spec.rb
- spec/models/commit_spec.rb 18 additions, 0 deletionsspec/models/commit_spec.rb
Please register or sign in to comment