Skip to content

Commit

Permalink
Allow pound sign (anchor) for LegacyPageUrl as its a valid URI character
Browse files Browse the repository at this point in the history
  • Loading branch information
robinboening committed Dec 12, 2020
1 parent c7cde4f commit 23f125c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/alchemy/legacy_page_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ class Alchemy::LegacyPageUrl < ActiveRecord::Base

validates :urlname,
presence: true,
format: {with: /\A[:\.\w\-+_\/\?&%;=]*\z/}
format: {with: /\A[:\.\w\-+_\/\?&%;=#]*\z/}
end
6 changes: 6 additions & 0 deletions spec/models/alchemy/legacy_page_url_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@
it "is also valid with get parameters in urlname" do
expect(page_url_with_parameters).to be_valid
end

it "is valid with pound sign in urlname" do
expect(
Alchemy::LegacyPageUrl.new(urlname: "with#anchor", page: page)
).to be_valid
end
end

0 comments on commit 23f125c

Please sign in to comment.