Skip to content

Commit

Permalink
Merge pull request edp963#2149 from xxxllluuu/dev-0.3
Browse files Browse the repository at this point in the history
Fix: Trim problem
  • Loading branch information
scottsut authored Feb 9, 2021
2 parents f0b4fa0 + 7abc35c commit 963ec8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ public List<String> getSqls(String sqlStr, boolean isQuery) {
String[] sqls = sqlStr.split(SEMICOLON);
if (sqls.length > 0) {
for (String sql : sqls) {
sql = sql.trim();
boolean select = isQuery(sql);
if (isQuery) {
if (select) {
Expand All @@ -297,11 +296,14 @@ public List<String> getSqls(String sqlStr, boolean isQuery) {
}

private boolean isQuery(String sql) {

sql = sql.trim();

if (sql.toLowerCase().startsWith(SELECT) || sql.toLowerCase().startsWith(WITH)) {
return true;
}

String temp = filterAnnotate(sql);
String temp = filterAnnotate(sql).trim();
return temp.toLowerCase().startsWith(SELECT) || temp.toLowerCase().startsWith(WITH);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public ResultMap uploadAvatar(User user, MultipartFile file, HttpServletRequest

//校验文件是否图片
if (!fileUtils.isImage(file)) {
return resultMap.failAndRefreshToken(request).message("file format error");
return resultMap.failAndRefreshToken(request).message("File format error");
}

//上传文件
Expand All @@ -479,7 +479,7 @@ public ResultMap uploadAvatar(User user, MultipartFile file, HttpServletRequest
try {
avatar = fileUtils.upload(file, Constants.USER_AVATAR_PATH, fileName);
if (StringUtils.isEmpty(avatar)) {
return resultMap.failAndRefreshToken(request).message("user avatar upload error");
return resultMap.failAndRefreshToken(request).message("User avatar upload error");
}
} catch (Exception e) {
log.error("User avatar upload error, username:{}", user.getUsername(), e);
Expand All @@ -500,7 +500,7 @@ public ResultMap uploadAvatar(User user, MultipartFile file, HttpServletRequest
return resultMap.successAndRefreshToken(request).payload(map);
}

return resultMap.failAndRefreshToken(request).message("server error, user avatar update fail");
return resultMap.failAndRefreshToken(request).message("Server error, user avatar update fail");
}


Expand All @@ -518,7 +518,7 @@ public ResultMap getUserProfile(Long id, User user, HttpServletRequest request)

User tempUser = userMapper.getById(id);
if (null == tempUser) {
return resultMap.failAndRefreshToken(request).message("user not found");
return resultMap.failAndRefreshToken(request).message("User not found");
}

UserProfile userProfile = new UserProfile();
Expand Down Expand Up @@ -578,7 +578,7 @@ public String forgetPassword(UserDistinctType userDistinctType, UserDistinctTick
case USERNAME:
String username = ticket.getTicket();
if (StringUtils.isEmpty(username)) {
throw new ServerException("username cannot be EMPTY!");
throw new ServerException("Username cannot be EMPTY!");
}
user = userMapper.selectByUsername(username);
if (user == null) {
Expand Down

0 comments on commit 963ec8f

Please sign in to comment.