Allow CodePen usernames to be up to 30 characters long (#3592) [ci skip]
This commit is contained in:
parent
96c33f93af
commit
b37522a45c
2 changed files with 8 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ class CodepenTag < LiquidTagBase
|
|||
def valid_link?(link)
|
||||
link_no_space = link.delete(" ")
|
||||
(link_no_space =~
|
||||
/^(http|https):\/\/(codepen\.io|codepen\.io\/team)\/[a-zA-Z0-9_\-]{1,20}\/pen\/([a-zA-Z]{5,7})\/{0,1}\z/)&.zero?
|
||||
/^(http|https):\/\/(codepen\.io|codepen\.io\/team)\/[a-zA-Z0-9_\-]{1,30}\/pen\/([a-zA-Z]{5,7})\/{0,1}\z/)&.zero?
|
||||
end
|
||||
|
||||
def raise_error
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ RSpec.describe CodepenTag, type: :liquid_template do
|
|||
end.to raise_error(StandardError)
|
||||
end
|
||||
|
||||
it "rejects codepen link with more than 30 characters in the username" do
|
||||
codepen_link = "https://codepen.io/t_white96_this_is_31_characters/pen/XKqrJX/"
|
||||
expect do
|
||||
generate_new_liquid(codepen_link)
|
||||
end.to raise_error(StandardError)
|
||||
end
|
||||
|
||||
it "accepts codepen link with a default-tab parameter" do
|
||||
expect do
|
||||
generate_new_liquid(codepen_link_with_default_tab)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue