Skip to content

Commit

Permalink
add check whether a content item is a wiki page to avoid MPE
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Nov 29, 2012
1 parent a995055 commit 5465a5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion grails-app/controllers/org/grails/ContentController.groovy
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5465a5a

Please sign in to comment.