diff --git a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/ajax/ThemeDataServlet.java b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/ajax/ThemeDataServlet.java index 694c736ddf..bf395a2a0a 100644 --- a/app/src/main/java/org/apache/roller/weblogger/ui/struts2/ajax/ThemeDataServlet.java +++ b/app/src/main/java/org/apache/roller/weblogger/ui/struts2/ajax/ThemeDataServlet.java @@ -17,6 +17,7 @@ */ package org.apache.roller.weblogger.ui.struts2.ajax; +import org.apache.commons.text.StringEscapeUtils; import org.apache.roller.weblogger.WebloggerException; import org.apache.roller.weblogger.business.WebloggerFactory; import org.apache.roller.weblogger.business.themes.SharedTheme; @@ -80,17 +81,21 @@ public void doGet( } for (Iterator it = themes.iterator(); it.hasNext();) { SharedTheme theme = it.next(); + // Theme metadata comes from theme.xml, which an operator can edit + // or install; escape it so a quote or newline cannot break out of + // the string and produce malformed JSON. pw.print(" { \"id\" : \""); - pw.print(theme.getId()); + pw.print(StringEscapeUtils.escapeJson(theme.getId())); pw.print("\", "); pw.print("\"name\" : \""); - pw.print(theme.getName()); + pw.print(StringEscapeUtils.escapeJson(theme.getName())); pw.print("\", "); pw.print("\"description\" : \""); - pw.print(theme.getDescription()); + pw.print(StringEscapeUtils.escapeJson(theme.getDescription())); pw.print("\", "); pw.print("\"previewPath\" : \""); - pw.print("/themes" + "/" + theme.getId() + "/" + theme.getPreviewImage().getPath()); + pw.print(StringEscapeUtils.escapeJson( + "/themes" + "/" + theme.getId() + "/" + theme.getPreviewImage().getPath())); pw.print("\" }"); if (it.hasNext()) { pw.println(", "); diff --git a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp index 48c4f08f16..b574975fc5 100644 --- a/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp @@ -115,7 +115,7 @@ function previewImage(themeId) { $.ajax({ url: "/roller-ui/authoring/themedata", data: {theme:themeId}, success: function(data) { - $('#themedescription').html(data.description); + $('#themedescription').text(data.description); $('#themeThumbnail').attr('src','' + data.previewPath); } }); diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp index d004596b23..9c9889509f 100644 --- a/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/editor/Bookmarks.jsp @@ -131,7 +131,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and - + " target="_blank"> @@ -143,13 +143,13 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and - ', - '', - '', - '', - '', - '' )"> + " + data-bookmark-name="" + data-bookmark-url="" + data-bookmark-feed-url="" + data-bookmark-description="" + data-bookmark-image=""> @@ -338,7 +338,7 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and function confirmDeleteFolder() { $('#boomarks_delete_folder_folderId').val($('#bookmarks_folderId:first').val()); - $('#deleteBlogrollName').html(''); + $('#deleteBlogrollName').text($('#deleteBlogrollName').data('folder-name')); $('#delete-blogroll-modal').modal({show: true}); } @@ -565,7 +565,8 @@ We used to call them Bookmarks and Folders, now we call them Blogroll links and