Skip to content

Commit dd2333a

Browse files
authored
Merge pull request #15208 from jdaugherty/issue15129
2 parents fea72fe + da60a9c commit dd2333a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

grails-gradle/model/src/main/groovy/grails/io/IOUtils.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,12 @@ class IOUtils extends SpringIOUtils {
194194
String rootPath = classRes.toString() - pathToClassFile
195195
if (rootPath.endsWith(BuildSettings.BUILD_CLASSES_PATH)) {
196196
rootPath = rootPath.replace('/build/classes/groovy/', '/build/resources/')
197-
} else {
197+
}
198+
199+
if (!rootPath.endsWith('/')) {
198200
rootPath = "$rootPath/"
199201
}
202+
200203
return new URL(rootPath)
201204
}
202205
return null

grails-gradle/model/src/test/groovy/grails/io/IOUtilsSpec.groovy

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package grails.io
2121
import org.grails.io.support.Resource
2222
import spock.lang.Specification
2323

24-
class IOUtilsSpec extends Specification{
24+
class IOUtilsSpec extends Specification {
2525

2626
void "Test findClassResource finds a class resource"() {
2727
expect:
@@ -34,4 +34,13 @@ class IOUtilsSpec extends Specification{
3434
IOUtils.findJarResource(Specification)
3535
IOUtils.findJarResource(Specification).path.endsWith('spock-core-2.3-groovy-3.0.jar!/')
3636
}
37+
38+
void 'findRootResourcesURL - appends / if not present'() {
39+
when:
40+
def result = IOUtils.findRootResourcesURL(IOUtils).toString()
41+
42+
then:
43+
result.startsWith('file:')
44+
result.endsWith('/')
45+
}
3746
}

0 commit comments

Comments
 (0)