Skip to content

Commit

Permalink
remove multiple dashes in escaped URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bumann committed Aug 16, 2008
1 parent e0953cf commit cd69ee0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2007 [name of plugin creator]
Copyright (c) 2007 [Michael Bumann - Railslove.com]

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
1 change: 1 addition & 0 deletions lib/find_by_param.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def escape(str)
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', str.dup).to_s
returning str.dup.to_s do |s|
s.gsub!(/\ +/, '-') # spaces to dashes, preferred separator char everywhere
s.gsub!(/\-+/,'-') # ----- to -
s.gsub!(/[^\w^-]+/, '') # kill non-word chars except -
s.strip! # ohh la la
s.downcase! # :D
Expand Down

0 comments on commit cd69ee0

Please sign in to comment.