mirror of https://github.com/Xhofe/alist
fix(lanzou): correct comment parsing logic in lanzou driver (#9278)
- Adjusted logic to skip incrementing index when exiting comments. - Added checks to continue loop if inside a single-line or block comment. - Prevents erroneous parsing and retains intended comment exclusion.main
parent
eca500861a
commit
74e384175b
|
@ -94,6 +94,7 @@ func RemoveJSComment(data string) string {
|
||||||
}
|
}
|
||||||
if inComment && v == '*' && i+1 < len(data) && data[i+1] == '/' {
|
if inComment && v == '*' && i+1 < len(data) && data[i+1] == '/' {
|
||||||
inComment = false
|
inComment = false
|
||||||
|
i++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v == '/' && i+1 < len(data) {
|
if v == '/' && i+1 < len(data) {
|
||||||
|
@ -108,6 +109,9 @@ func RemoveJSComment(data string) string {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if inComment || inSingleLineComment {
|
||||||
|
continue
|
||||||
|
}
|
||||||
result.WriteByte(v)
|
result.WriteByte(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue