From 46c5d74ac5f97f6fc775a0f445331deb4c8b16da Mon Sep 17 00:00:00 2001 From: Jesper Zedlitz Date: Fri, 13 Jan 2017 15:44:54 +0100 Subject: [PATCH] fixed https://github.com/grails-plugins/grails-resources/issues/62 --- .../org/grails/plugin/resource/ResourceProcessor.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy b/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy index 9deef46..809fc6a 100644 --- a/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy +++ b/src/groovy/org/grails/plugin/resource/ResourceProcessor.groovy @@ -567,7 +567,7 @@ class ResourceProcessor implements InitializingBean, ServletContextAware { File makeFileForURI(String uri) { def splitPoint = uri.lastIndexOf('/') def fileSystemDir = splitPoint > 0 ? makeFileSystemPathFromURI(uri[0..splitPoint - 1]) : '' - def fileSystemFile = makeFileSystemPathFromURI(uri[splitPoint + 1..-1]) + def fileSystemFile = uri.length() <= splitPoint+1? '': makeFileSystemPathFromURI(uri[splitPoint + 1..-1]) def staticDir = new File(getWorkDir(), fileSystemDir) // force the structure @@ -583,7 +583,7 @@ class ResourceProcessor implements InitializingBean, ServletContextAware { log.debug "Creating file object for URI [$uri] from [${staticDir}] and [${fileSystemFile}]" File f = new File(staticDir, fileSystemFile) // Delete the existing file - it may be from previous release, we cannot tell. - if (f.exists()) { + if (f.exists() && f.isFile()) { assert f.delete() } return f