Put this in a constant array "SafePrefixs" and do a parse of the URI.  In fact, make this code look like https://github.com/openshift/origin-server/blob/master/common/lib/openshift-origin-common/utils/git.rb