UX: Strip multiline comments in github oneboxes (#30040)

We were already stripping comments from GitHub issue/PR oneboxes, but the regex was not correctly matching multiline comments.
This commit is contained in:
David Taylor 2024-12-02 18:08:55 +00:00 committed by GitHub
parent 31dadc8373
commit b47ae6d437
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 2 additions and 4 deletions

View File

@ -12,8 +12,6 @@ module Onebox
include Onebox::Mixins::GithubBody
include Onebox::Mixins::GithubAuthHeader
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
matches_regexp(%r{^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/pull})
always_https

View File

@ -11,7 +11,7 @@ module Onebox
include JSON
include Onebox::Mixins::GithubAuthHeader
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/
GITHUB_COMMENT_REGEX = /(<!--.*?-->\r\n)/m
matches_regexp(%r{^https?:\/\/(?:www\.)?(?!gist\.)[^\/]*github\.com\/[^\/]+\/[^\/]+\/?$})
always_https

View File

@ -9,7 +9,7 @@ module Onebox
end
module InstanceMethods
GITHUB_COMMENT_REGEX = /<!--.*?-->/
GITHUB_COMMENT_REGEX = /<!--.*?-->/m
MAX_BODY_LENGTH = 80
def compute_body(body)