Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 5465a5a351811bd3675adab2eef1d8919aab6d97 1 parent a995055
graemerocher graemerocher authored
2  grails-app/controllers/org/grails/ContentController.groovy
@@ -56,7 +56,7 @@ class ContentController extends BaseWikiController {
56 56 redirect controller: "plugin", action: "show", params: [name: wikiPage.plugin.name], permanent: true
57 57 }
58 58 }
59   - else if (wikiPage) {
  59 + else if (wikiPage?.instanceOf(WikiPage)) {
60 60 // Permanent redirect for deprecated pages that have an alternative URL.
61 61 if (wikiPage.deprecated && wikiPage.deprecatedUri) {
62 62 redirect uri: wikiPage.deprecatedUri, permanent: true
16 grails-app/controllers/org/grails/plugin/PluginAdminController.groovy
@@ -40,9 +40,9 @@ class PluginAdminController {
40 40 for(p in plugins) {
41 41 boolean pluginUpdated = false
42 42 if(p.description.title != "plugin-${p.name}-description".toString()) {
43   - def key = "plugin-${p.name}-description"
  43 + def key = "plugin-${p.name}-description".toString()
44 44
45   - def existing = PluginTab.findByTitle(key)
  45 + def existing = PluginTab.where { title == key }.find()
46 46 if(existing && existing.version == 0) {
47 47 existing.body = p.description.body
48 48 p.description = existing
@@ -56,8 +56,8 @@ class PluginAdminController {
56 56 }
57 57 if(p.installation.title != "plugin-${p.name}-installation".toString()) {
58 58
59   - def key = "plugin-${p.name}-installation"
60   - def existing = PluginTab.findByTitle(key)
  59 + def key = "plugin-${p.name}-installation".toString()
  60 + def existing = PluginTab.where { title == key }.find()
61 61 if(existing && existing.version == 0) {
62 62 existing.body = p.installation.body
63 63 p.installation = existing
@@ -71,8 +71,8 @@ class PluginAdminController {
71 71 }
72 72 if(p.faq.title != "plugin-${p.name}-faq".toString()) {
73 73
74   - def key = "plugin-${p.name}-faq"
75   - def existing = PluginTab.findByTitle(key)
  74 + def key = "plugin-${p.name}-faq".toString()
  75 + def existing = PluginTab.where { title == key }.find()
76 76 if(existing && existing.version == 0) {
77 77 existing.body = p.faq.body
78 78 p.faq= existing
@@ -86,8 +86,8 @@ class PluginAdminController {
86 86 }
87 87 if(p.screenshots.title != "plugin-${p.name}-screenshots".toString()) {
88 88
89   - def key = "plugin-${p.name}-screenshots"
90   - def existing = PluginTab.findByTitle(key)
  89 + def key = "plugin-${p.name}-screenshots".toString()
  90 + def existing = PluginTab.where { title == key }.find()
91 91 if(existing && existing.version == 0) {
92 92 existing.body = p.screenshots.body
93 93 p.screenshots= existing

0 comments on commit 5465a5a

Please sign in to comment.
Something went wrong with that request. Please try again.