Skip to content

Commit ef222eb

Browse files
Fix a bug in this plugin that is causing file upload to fail in DECK.
This is related to ARKLEM-846.
1 parent ffec16f commit ef222eb

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ build/
99
.project
1010
.settings
1111
.classpath
12+
/bin/

functional-tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

src/main/groovy/grails/plugin/cache/redis/CacheRedisGrailsPlugin.groovy

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,32 @@ class CacheRedisGrailsPlugin extends Plugin {
126126
usePrefix = isUsePrefix
127127
}
128128

129-
grailsCacheFilter(RedisPageFragmentCachingFilter) {
130-
cacheManager = ref('grailsCacheManager')
131-
nativeCacheManager = ref('grailsCacheRedisTemplate')
132-
// TODO this name might be brittle - perhaps do by type?
133-
cacheOperationSource = ref('org.springframework.cache.annotation.AnnotationCacheOperationSource#0')
134-
keyGenerator = ref('webCacheKeyGenerator')
135-
expressionEvaluator = ref('webExpressionEvaluator')
136-
}
129+
/*
130+
* DOC - !!!!!!!!!!!
131+
*
132+
* This is commented out because it introduces a bug causing NullPointerException for file upload,
133+
* so we don't want to use the `RedisPageFragmentCachingFilter` implementation, but use the default one instead.
134+
*
135+
* The bug is: when we do a file upload, we can get the file in the controler by `params.attachmentFile`.
136+
* That is how we code it in almost every place in DECK. However, when grails cache redis is enabled,
137+
* the `RedisPageFragmentCachingFilter` implementation would massage the request while doing its caching work,
138+
* but somehow missed the `attachmentFile`, and `params.attachmentFile` in a controller would be empty.
139+
* There is a work-around that we can get the file by calling `request.getMultipartFiles()`, but we have to
140+
* change it for every single place in DECK, which isn't ideal.
141+
*
142+
* So this is the bug fix. Also this plugin version is based on an old version of grails-cache plugin - 3.0.3.
143+
* grails-cache 4.0 has a very different implementation and hopefully this is no longer an issue.
144+
* Will check it out when we upgrade to Grails 4.
145+
*
146+
*/
147+
// grailsCacheFilter(RedisPageFragmentCachingFilter) {
148+
// cacheManager = ref('grailsCacheManager')
149+
// nativeCacheManager = ref('grailsCacheRedisTemplate')
150+
// // TODO this name might be brittle - perhaps do by type?
151+
// cacheOperationSource = ref('org.springframework.cache.annotation.AnnotationCacheOperationSource#0')
152+
// keyGenerator = ref('webCacheKeyGenerator')
153+
// expressionEvaluator = ref('webExpressionEvaluator')
154+
// }
137155
}
138156
}
139157

0 commit comments

Comments
 (0)