-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: not fond for video subtitle (#565)
* fix: not fond for video subtitle. * docs: update CHANGELOG.MD
- Loading branch information
GuoHao
authored
Jun 15, 2024
1 parent
6198023
commit 0be9d2f
Showing
3 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
## 问题修复 | ||
|
||
- 主题相关的模板引擎初始化问题 | ||
- 视频文件名带有中括号等特殊字符的,sql的like匹配不到字幕 | ||
|
||
# 0.12.0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
server/src/main/java/run/ikaros/server/infra/utils/SqlUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package run.ikaros.server.infra.utils; | ||
|
||
public class SqlUtils { | ||
|
||
/** | ||
* 转义所有可能的特殊字符的函数. | ||
*/ | ||
public static String escapeLikeSpecialChars(String input) { | ||
if (input == null) { | ||
return null; | ||
} | ||
return input.replaceAll("([\\\\_%\\[\\]])", "\\\\$1") | ||
.replace("-", "\\-") | ||
.replace("!", "\\!") | ||
.replace("'", "''") | ||
.replace("`", "\\`") | ||
.replace("\"", "\\\"") | ||
.replace("*", "\\*") | ||
.replace("(", "\\(") | ||
.replace(")", "\\)") | ||
.replace("{", "\\{") | ||
.replace("}", "\\}") | ||
.replace("<", "\\<") | ||
.replace(">", "\\>") | ||
.replace("#", "\\#") | ||
.replace("&", "\\&") | ||
.replace("|", "\\|") | ||
.replace("^", "\\^") | ||
.replace("~", "\\~") | ||
.replace("$", "\\$") | ||
.replace("?", "\\?") | ||
.replace("+", "\\+") | ||
.replace(";", "\\;") | ||
.replace(":", "\\:") | ||
.replace("@", "\\@") | ||
.replace("/", "\\/") | ||
.replace("=", "\\=") | ||
.replace(",", "\\,") | ||
.replace(".", "\\.") | ||
.replace(" ", "\\ "); | ||
} | ||
} |