Commit 733b55ab authored by Liang Ding's avatar Liang Ding

.

parent 5dd39fe7
...@@ -94,7 +94,7 @@ public final class Starter { ...@@ -94,7 +94,7 @@ public final class Starter {
final Option staticServerPortOpt = Option.builder("ssp").longOpt("static_server_port").argName("STATIC_SERVER_PORT") final Option staticServerPortOpt = Option.builder("ssp").longOpt("static_server_port").argName("STATIC_SERVER_PORT")
.hasArg().desc("browser visit static resource port, default is 8080").build(); .hasArg().desc("browser visit static resource port, default is 8080").build();
options.addOption(staticServerPortOpt); options.addOption(staticServerPortOpt);
final Option runtimeModeOpt = Option.builder("rm").longOpt("runtime_mode").argName("RUNTIME_MODE") final Option runtimeModeOpt = Option.builder("rm").longOpt("runtime_mode").argName("RUNTIME_MODE")
.hasArg().desc("runtime mode (DEVELOPMENT/PRODUCTION), default is DEVELOPMENT").build(); .hasArg().desc("runtime mode (DEVELOPMENT/PRODUCTION), default is DEVELOPMENT").build();
options.addOption(runtimeModeOpt); options.addOption(runtimeModeOpt);
...@@ -142,8 +142,10 @@ public final class Starter { ...@@ -142,8 +142,10 @@ public final class Starter {
String staticServerPort = commandLine.getOptionValue("static_server_port"); String staticServerPort = commandLine.getOptionValue("static_server_port");
Latkes.setStaticServerPort(staticServerPort); Latkes.setStaticServerPort(staticServerPort);
String runtimeMode = commandLine.getOptionValue("runtime_mode"); String runtimeMode = commandLine.getOptionValue("runtime_mode");
Latkes.setRuntimeMode(RuntimeMode.valueOf(runtimeMode)); if (null != runtimeMode) {
Latkes.setRuntimeMode(RuntimeMode.valueOf(runtimeMode));
}
logger.info("Standalone mode, see [https://github.com/b3log/solo/wiki/standalone_mode] for more details."); logger.info("Standalone mode, see [https://github.com/b3log/solo/wiki/standalone_mode] for more details.");
Latkes.initRuntimeEnv(); Latkes.initRuntimeEnv();
......
...@@ -341,7 +341,7 @@ public class CommentMgmtService { ...@@ -341,7 +341,7 @@ public class CommentMgmtService {
return ret; return ret;
} }
String commentContent = requestJSONObject.optString(Comment.COMMENT_CONTENT).replaceAll("\\n", "<br/>"); String commentContent = requestJSONObject.optString(Comment.COMMENT_CONTENT);
if (MAX_COMMENT_CONTENT_LENGTH < commentContent.length() || MIN_COMMENT_CONTENT_LENGTH > commentContent.length()) { if (MAX_COMMENT_CONTENT_LENGTH < commentContent.length() || MIN_COMMENT_CONTENT_LENGTH > commentContent.length()) {
LOGGER.log(Level.WARN, "Comment conent length is invalid[{0}]", commentContent.length()); LOGGER.log(Level.WARN, "Comment conent length is invalid[{0}]", commentContent.length());
...@@ -356,7 +356,6 @@ public class CommentMgmtService { ...@@ -356,7 +356,6 @@ public class CommentMgmtService {
commentName = Jsoup.clean(commentName, Whitelist.none()); commentName = Jsoup.clean(commentName, Whitelist.none());
requestJSONObject.put(Comment.COMMENT_NAME, commentName); requestJSONObject.put(Comment.COMMENT_NAME, commentName);
commentContent = commentContent.replaceAll("\\n", "<br/>\n");
// content Markdown & XSS process // content Markdown & XSS process
commentContent = Markdowns.toHTML(commentContent); commentContent = Markdowns.toHTML(commentContent);
commentContent = Jsoup.clean(commentContent, Whitelist.relaxed()); commentContent = Jsoup.clean(commentContent, Whitelist.relaxed());
......
...@@ -193,7 +193,7 @@ public class UpgradeService { ...@@ -193,7 +193,7 @@ public class UpgradeService {
comment.put(Comment.COMMENT_NAME, name); comment.put(Comment.COMMENT_NAME, name);
String content = comment.optString(Comment.COMMENT_CONTENT); String content = comment.optString(Comment.COMMENT_CONTENT);
content = StringEscapeUtils.unescapeHtml(content).replaceAll("_esc_enter_88250_", "<br/>"); content = StringEscapeUtils.unescapeHtml(content).replaceAll("_esc_enter_88250_", "\n\n");
content = Markdowns.toHTML(content); content = Markdowns.toHTML(content);
content = Jsoup.clean(content, Whitelist.relaxed()); content = Jsoup.clean(content, Whitelist.relaxed());
comment.put(Comment.COMMENT_CONTENT, content); comment.put(Comment.COMMENT_CONTENT, content);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment