Skip to content

Commit

Permalink
Merge pull request #700 from alexandergraul/improve-package-route-con…
Browse files Browse the repository at this point in the history
…traints

Improve package routes
  • Loading branch information
Ana06 committed Nov 6, 2019
2 parents db48735 + eca6ab2 commit 8988f3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -122,7 +122,7 @@ def render_json(json, options = {})
end

def valid_package_name?(name)
name =~ /^[[:alnum:]][-+\w\.:\@]*$/
name =~ /^[[:alnum:]][-+~\w\.:\@]*$/
end

def valid_pattern_name?(name)
Expand Down
16 changes: 8 additions & 8 deletions config/routes.rb
Expand Up @@ -21,15 +21,15 @@
get 'images.xml', to: 'images#images'

controller :package do
get 'package/:package' => :show, :constraints => { :package => /[-+\w\.:\@]+/ }
get 'package/thumbnail/:package.png' => :thumbnail, :constraints => { :package => /[-+\w\.:\@]+/ }
get 'package/screenshot/:package.png' => :screenshot, :constraints => { :package => /[-+\w\.:\@]+/ }
get 'package/:package', action: :show, constraints: { package: /[-+~\w\.:\@]+/ }
get 'package/thumbnail/:package.png', action: :thumbnail, constraints: { package: /[-+~\w\.:\@]+/ }
get 'package/screenshot/:package.png', action: :screenshot, constraints: { package: /[-+~\w\.:\@]+/ }

get 'explore' => :explore
get 'packages' => :explore
get 'appstore' => :explore
get 'packages/:category' => :category, :constraints => { :category => /[\w\-\.: ]+/ }
get 'appstore/:category' => :category, :constraints => { :category => /[\w\-\.: ]+/ }
get 'explore', action: :explore
get 'packages', action: :explore
get 'appstore', action: :explore
get 'packages/:category', action: :category, constraints: { category: /[\w\-\.: ]+/ }
get 'appstore/:category', action: :category, constraints: { category: /[\w\-\.: ]+/ }
end

namespace 'download' do
Expand Down

0 comments on commit 8988f3b

Please sign in to comment.