Skip to content

Commit

Permalink
Add support for Gemini urls (#15013)
Browse files Browse the repository at this point in the history
This PR updates the `valid_url` regex and sanitizer allowlist to provide
support for Gemini urls.

Closes #14991
  • Loading branch information
joshleeb authored Oct 19, 2020
1 parent 4130aef commit 0c24f4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/lib/sanitize_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Config
gopher
xmpp
magnet
gemini
).freeze

CLASS_WHITELIST_TRANSFORMER = lambda do |env|
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/twitter_regex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Regex
( # $1 total match
(#{REGEXEN[:valid_url_preceding_chars]}) # $2 Preceding character
( # $3 URL
((?:https?|dat|dweb|ipfs|ipns|ssb|gopher):\/\/)? # $4 Protocol (optional)
((?:https?|dat|dweb|ipfs|ipns|ssb|gopher|gemini):\/\/)? # $4 Protocol (optional)
(#{REGEXEN[:valid_domain]}) # $5 Domain(s)
(?::(#{REGEXEN[:valid_port_number]}))? # $6 Port number (optional)
(/#{REGEXEN[:valid_url_path]}*)? # $7 URL Path and anchor
Expand Down

0 comments on commit 0c24f4d

Please sign in to comment.