mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
refactor: fix file condition checks
This commit is contained in:
1 parent
64215d3ef1
commit
4ab3096fa5
5 files changed
+16
-20
No files matched your search
@@ -1,13 +1,14 @@
|
||||
import { execFile } from 'child_process'
|
||||
|
||||
import { buildFileCheckCmd } from '@linux-odyssey/utils'
|
||||
import type { IFileCondition } from '@linux-odyssey/models'
|
||||
|
||||
function sanitizeId(id) {
|
||||
function sanitizeId(id: string) {
|
||||
return id.replace(/[^a-zA-Z0-9]/g, '')
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function checkFile(id, file) {
|
||||
export function checkFile(id: string, file: IFileCondition) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cmd = buildFileCheckCmd(file)
|
||||
// WARNING: This is vulnerable to command injection
|
||||
Reference in new issue
Block a user