Created
February 21, 2014 19:53
-
-
Save lutter/9142098 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app.rb b/app.rb | |
index ae74307..75f43f2 100644 | |
--- a/app.rb | |
+++ b/app.rb | |
@@ -505,6 +505,21 @@ class Razor::App < Sinatra::Base | |
command :create_repo do |data| | |
check_permissions! "commands:create-repo:#{data['name']}" | |
+ | |
+ unless data['name'].is_a? String | |
+ error 400, :error => I18n::t("create_repo.name.must_be_string", :class => friendly_class(data['name'])) | |
+ end | |
+ | |
+ unless data['name'] ~= HORRENDOUS_REGEXP | |
+ error 400, :error => I18n::t("create_repo.name.invalid_chars", :value => data['name']) | |
+ end | |
# Create our shiny new repo. This will implicitly, thanks to saving | |
# changes, trigger our loading saga to begin. (Which takes place in the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The actual calls to 'error' should probably make sure machine-readable info winds up in the error, too; i.e. more something like