12 lines
703 B
Python
12 lines
703 B
Python
#!/usr/bin/env python3
|
|||
|
|
# 把两处 helper 内的 request.log.warn(无 request 上下文)改为服务日志
|
||
|
|
import io
|
||
|
|
OLD = " request.log.warn({ findings: scanFindings.slice(0, 20), count: scanFindings.length }, 'upload-scan-warnings')"
|
||
|
|
NEW = (" process.stderr.write(\n"
|
||
|
|
" `[upload-scan-warnings] ${JSON.stringify({ count: scanFindings.length, findings: scanFindings.slice(0, 20) })}\\n`,\n"
|
||
|
|
" )")
|
||
|
|
for p in ("/opt/dshs/src/web/routes/business-plugins.ts", "/opt/dshs/src/web/routes/skills.ts"):
|
||
|
|
s = io.open(p, encoding='utf-8').read()
|
||
|
|
assert OLD in s, p
|
||
|
|
io.open(p, 'w', encoding='utf-8', newline='').write(s.replace(OLD, NEW, 1))
|
||
|
|
print('fixed', p)
|