mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-07-18 17:38:07 +08:00
fix(lanzou): fix removing JavaScript comments from response data (#37)
* 修复清理js中块注释的bug 移除块注释,目前只将开始“/*”和结束的“*/”移除,未将注释中内容移除 Signed-off-by: 410680876f1 <71364356+410680876f1@users.noreply.github.com> * 修复清理js中注释的bug 移注释,目前只将注释标识符号清楚,注释中内容被遗留了下来 感谢大佬@Kuingsmile的代码审核 Signed-off-by: 410680876f1 <71364356+410680876f1@users.noreply.github.com> * 代码格式化 Signed-off-by: 410680876f1 <71364356+410680876f1@users.noreply.github.com> --------- Signed-off-by: 410680876f1 <71364356+410680876f1@users.noreply.github.com> Co-authored-by: Hantong Chen <70561268+cxw620@users.noreply.github.com>
This commit is contained in:
@ -94,6 +94,10 @@ func RemoveJSComment(data string) string {
|
||||
}
|
||||
if inComment && v == '*' && i+1 < len(data) && data[i+1] == '/' {
|
||||
inComment = false
|
||||
i++
|
||||
continue
|
||||
}
|
||||
if inComment || inSingleLineComment {
|
||||
continue
|
||||
}
|
||||
if v == '/' && i+1 < len(data) {
|
||||
|
Reference in New Issue
Block a user