Skip to content

Commit 8f5bd10

Browse files
committed
OTWO-1489 Added a validation for SVN Repo URL if empty
1 parent ce112d2 commit 8f5bd10

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/scm/adapters/svn/validation.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def validate_username
2626

2727
# If the URL is a simple directory path, make sure it is prefixed by file://
2828
def path_to_file_url(path)
29-
return nil if path.blank?
29+
return nil if path.empty?
3030
url =~ /:\/\// ? url : 'file://' + File.expand_path(path)
3131
end
3232

test/unit/svn_validation_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ def test_valid_usernames
77
assert !SvnAdapter.new(:username => username).validate_username
88
end
99
end
10+
11+
def test_for_blank_svn_urls
12+
svn = SvnAdapter.new(:url =>"")
13+
assert_nil svn.path_to_file_url(svn.url)
14+
end
15+
16+
def test_for_non_blank_svn_urls
17+
svn = SvnAdapter.new(:url =>"/home/rapbhan")
18+
assert_equal 'file:///home/rapbhan', svn.path_to_file_url(svn.url)
19+
end
1020

1121
def test_rejected_urls
1222
[ nil, "", "foo", "http:/", "http:://", "http://",

0 commit comments

Comments
 (0)