-
Notifications
You must be signed in to change notification settings - Fork 106
增加博客类型,xss攻击拦截 #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增加博客类型,xss攻击拦截 #101
Conversation
|
SQL的修改可以提交到document文档里面的SQL语句当中噢,直接在创建表的SQL语句上修改即可 |
|
当前新增的功能应该提交到dev分支,我根据你提的issue单独开了一个dev分支噢 分支的名称为 dev_blog_#100,你当前的代码应该合并到这个分支上。 |
stick-i
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请提交到dev_blog_#100分支上噢
blog-service/blog-server/src/main/java/cn/sticki/blog/pojo/bo/BlogSaveBO.java
Show resolved
Hide resolved
| return new RestResult<>(402, "参数异常", null, false); | ||
| String message = "参数异常"; | ||
| if (e instanceof IllegalArgumentException) { | ||
| message = "参数异常:" + e.getMessage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样校验是否会导致某些非人为控制抛出IllegalArgumentException的地方,会将异常信息返回到前端?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果有非我们显示调用抛出的IllegalArgumentException异常,说明是代码bug,需要修复,现在这个单独处理,是因为使用了spring的Assert 断言类,message描述了异常原因,需要主动抛给前端,进行友好提示。
也可以考虑自己创建断言类,自定义异常,不用或继承IllegalArgumentException

需要执行sql脚本
alter table blog.blog
add create_type int(1) null comment '博客创作类型:1. 原创; 2. 转载';
@stick-i