diff --git a/src/groovy/grails/plugin/svn/SvnClient.groovy b/src/groovy/grails/plugin/svn/SvnClient.groovy index a0f4409..bdf7f0a 100644 --- a/src/groovy/grails/plugin/svn/SvnClient.groovy +++ b/src/groovy/grails/plugin/svn/SvnClient.groovy @@ -404,12 +404,15 @@ class SvnClient { * @return A tuple of base URL, username, and password. */ protected final tokenizeUrl(url) { - // Parse the URL using SVNKit. + + def result = [] + def svnUrl = SVNURL.parseURIDecoded(url) // Start with the base URL. - def result = [] - if (!svnUrl.hasPort()) { + if (svnUrl.protocol == "file") { + result << url + } else if (!svnUrl.hasPort()) { // URL doesn't explicitly specify a port, so we don't include // it in the base URL either. result << "${svnUrl.protocol}://${svnUrl.host}${svnUrl.path}".toString() diff --git a/test/unit/grails/plugin/svn/SvnClientUnitTests.groovy b/test/unit/grails/plugin/svn/SvnClientUnitTests.groovy index a9deb7d..630a6f0 100644 --- a/test/unit/grails/plugin/svn/SvnClientUnitTests.groovy +++ b/test/unit/grails/plugin/svn/SvnClientUnitTests.groovy @@ -116,6 +116,18 @@ class SvnClientUnitTests extends GMockTestCase { } } + void testConstructorWithFileUrl() { + mockClientConstruction() + + play { + def testClient = new SvnClient("file:///local/repository/path") + println testClient.repoUrl.dump() + assert testClient.repoUrl?.path == "/local/repository/path" + assert testClient.repoUrl?.protocol == "file" + assert testClient.projectPath == "" + } + } + void testSetCredentials() { def mockUtil = mockClientConstruction() mockUtil.static.createDefaultAuthenticationManager("dilbert", "password")