Permalink
Browse files

add check whether a content item is a wiki page to avoid MPE

  • Loading branch information...
1 parent a995055 commit 5465a5a351811bd3675adab2eef1d8919aab6d97 @graemerocher graemerocher committed Nov 29, 2012
@@ -56,7 +56,7 @@ class ContentController extends BaseWikiController {
redirect controller: "plugin", action: "show", params: [name: wikiPage.plugin.name], permanent: true
}
}
- else if (wikiPage) {
+ else if (wikiPage?.instanceOf(WikiPage)) {
// Permanent redirect for deprecated pages that have an alternative URL.
if (wikiPage.deprecated && wikiPage.deprecatedUri) {
redirect uri: wikiPage.deprecatedUri, permanent: true
@@ -40,9 +40,9 @@ class PluginAdminController {
for(p in plugins) {
boolean pluginUpdated = false
if(p.description.title != "plugin-${p.name}-description".toString()) {
- def key = "plugin-${p.name}-description"
+ def key = "plugin-${p.name}-description".toString()
- def existing = PluginTab.findByTitle(key)
+ def existing = PluginTab.where { title == key }.find()
if(existing && existing.version == 0) {
existing.body = p.description.body
p.description = existing
@@ -56,8 +56,8 @@ class PluginAdminController {
}
if(p.installation.title != "plugin-${p.name}-installation".toString()) {
- def key = "plugin-${p.name}-installation"
- def existing = PluginTab.findByTitle(key)
+ def key = "plugin-${p.name}-installation".toString()
+ def existing = PluginTab.where { title == key }.find()
if(existing && existing.version == 0) {
existing.body = p.installation.body
p.installation = existing
@@ -71,8 +71,8 @@ class PluginAdminController {
}
if(p.faq.title != "plugin-${p.name}-faq".toString()) {
- def key = "plugin-${p.name}-faq"
- def existing = PluginTab.findByTitle(key)
+ def key = "plugin-${p.name}-faq".toString()
+ def existing = PluginTab.where { title == key }.find()
if(existing && existing.version == 0) {
existing.body = p.faq.body
p.faq= existing
@@ -86,8 +86,8 @@ class PluginAdminController {
}
if(p.screenshots.title != "plugin-${p.name}-screenshots".toString()) {
- def key = "plugin-${p.name}-screenshots"
- def existing = PluginTab.findByTitle(key)
+ def key = "plugin-${p.name}-screenshots".toString()
+ def existing = PluginTab.where { title == key }.find()
if(existing && existing.version == 0) {
existing.body = p.screenshots.body
p.screenshots= existing

0 comments on commit 5465a5a

Please sign in to comment.