Skip to content

Commit

Permalink
RESTRICT hyphens as a possible separator for permalink styles. [Chris…
Browse files Browse the repository at this point in the history
… Wanstrath]

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2697 567b1171-46fb-0310-a4c9-b4bef9110e78
  • Loading branch information
technoweenie committed Jan 16, 2007
1 parent 15bcc24 commit 911fe1c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
@@ -1,6 +1,6 @@
* SVN *

* Allow hyphens as an allowed separator for permalink styles. [Chris Wanstrath]
* RESTRICT hyphens as a possible separator for permalink styles. [Chris Wanstrath]

* Initial article/asset assignment support. Perfect for podcasting.

Expand Down
2 changes: 1 addition & 1 deletion app/models/site.rb
Expand Up @@ -212,7 +212,7 @@ def permalink_variable?(var)
def check_permalink_style
permalink_style.sub! /^\//, ''
permalink_style.sub! /\/$/, ''
pieces = permalink_style.split(Regexp.new('/|-'))
pieces = permalink_style.split('/')
errors.add :permalink_style, 'cannot have blank paths' if pieces.any?(&:blank?)
pieces.each do |p|
errors.add :permalink_style, "cannot contain '#{p}' variable" unless p.blank? || permalink_variable_format?(p).nil? || permalink_variable?(p)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/site_permalink_test.rb
Expand Up @@ -43,9 +43,9 @@ def setup
assert_equal "cannot contain ':foo' variable", @site.errors.on(:permalink_style)
end

specify "should recongize hyphens as token separators" do
specify "should not recongize hyphens as token separators" do
@site.permalink_style = ':id-:permalink'
assert_valid @site
assert !@site.valid?
end
end

Expand Down

0 comments on commit 911fe1c

Please sign in to comment.