lib/gitauth/command.rb in brownbeagle-gitauth-0.0.1 vs lib/gitauth/command.rb in brownbeagle-gitauth-0.0.2
- old
+ new
@@ -32,11 +32,11 @@
class BadCommandError < StandardError; end
# Standard Commands
READ_COMMANDS = ["git-upload-pack", "git upload-pack"]
WRITE_COMMANDS = ["git-receive-pack", "git receive-pack"]
- PATH_REGEXP = /^'([a-z0-9\-\+]+(\.git)?)'$/i.freeze
+ PATH_REGEXP = /^'([\w\_\-\.\+]+(\.git)?)'$/i.freeze
attr_reader :path, :verb, :command
def initialize(command)
@command = command
@@ -59,10 +59,10 @@
end
# These exceptions are FUGLY.
# Clean up, mmkay?
def process!
- raise BadCommandError if @command.include?("\n")
+ raise BadCommandError if @command.include?("\n") || @command !~ /^git/i
@verb, @argument = split_command
raise BadCommandError if @argument.nil? || @argument.is_a?(Array)
# Check if it's read / write
if READ_COMMANDS.include?(@verb)
@verb_type = :read
\ No newline at end of file