Skip to content

Commit 7528067

Browse files
author
Robin Luckey
committed
OTWO-204 Allow spaces in Subversion file paths
1 parent f0e7ea6 commit 7528067

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/scm/adapters/svn/validation.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module Scm::Adapters
22
class SvnAdapter < AbstractAdapter
33
def self.url_regex
4-
/^(file|http|https|svn):\/\/(\/)?[A-Za-z0-9_\-\.]+(:\d+)?(\/[A-Za-z0-9_\-\.\/\+%^~]*)?$/
4+
/^(file|http|https|svn):\/\/(\/)?[A-Za-z0-9_\-\.]+(:\d+)?(\/[A-Za-z0-9_\-\.\/\+%^~ ]*)?$/
55
end
66

77
def self.public_url_regex
8-
/^(http|https|svn):\/\/[A-Za-z0-9_\-\.]+(:\d+)?(\/[A-Za-z0-9_\-\.\/\+%^~]*)?$/
8+
/^(http|https|svn):\/\/[A-Za-z0-9_\-\.]+(:\d+)?(\/[A-Za-z0-9_\-\.\/\+%^~ ]*)?$/
99
end
1010

1111
def normalize

test/unit/svn_validation_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def test_rejected_urls
1212
[ nil, "", "foo", "http:/", "http:://", "http://",
1313
"sourceforge.net/svn/project/trunk", # missing a protocol prefix
1414
"http://robin@svn.sourceforge.net/", # must not include a username with the url
15-
"http://svn.sourceforge.net/asdf/asdf/ malicious code", # no spaces allowed
1615
"/home/robin/cvs", # local file paths not allowed
1716
"git://kernel.org/whatever/linux.git", # git protocol is not allowed
1817
":pserver:anonymous:@juicereceiver.cvs.sourceforge.net:/cvsroot/juicereceiver", # pserver is just wrong
@@ -38,7 +37,8 @@ def test_accepted_urls
3837
"http://svn.gnome.org/svn/gtk+/trunk", # + character OK
3938
"http://svn.gnome.org", # no path, no trailing /, just a domain name is OK
4039
"http://brlcad.svn.sourceforge.net/svnroot/brlcad/rt^3/trunk", # a caret ^ is allowed
41-
"http://www.thus.ch/~patrick/svn/pvalsecc" # ~ is allowed
40+
"http://www.thus.ch/~patrick/svn/pvalsecc", # ~ is allowed
41+
"http://franklinmath.googlecode.com/svn/trunk/Franklin Math", # space is allowed in path
4242
].each do |url|
4343
# Accepted for both internal and public use
4444
[true, false].each do |p|

0 commit comments

Comments
 (0)