Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitize mentions for merge requests in Gitlab #3437

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def source_provider_supports_html?
end

def sanitize_links_and_mentions(text, unsafe: false)
return text unless source.provider == "github"
return text unless source.provider == "github" || source.provider == "gitlab"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly we need something like...

return text if running_on?(:github) && source.provider == 'github'
return text if running_on?(:gitlab) && source.provider == 'gitlab'

Does that capture the reason that this PR is blocked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand, the issue is determining the source of Release notes and Changelog so we do not sanitize links pointing natively to Gitlab as Github links (I have not encountered such a case myself though).

If I understand correctly, source.provider is not that, it is basically a pointer where the dependabot-core runs and not where changelog comes from.


LinkAndMentionSanitizer.
new(github_redirection_service: github_redirection_service).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,8 @@ def commits_details(base:, head:)
Dependabot::Source.new(provider: "gitlab", repo: "gocardless/bump")
end

it "does not sanitize github links" do
expect(pr_message).not_to include(github_redirection_service)
it "sanitizes github links" do
expect(pr_message).to include(github_redirection_service)
end
end

Expand Down