fix: git URL后target只接受合法路径字符(拒绝中文)
This commit is contained in:
parent
fb1b65f389
commit
11cab45129
@ -888,7 +888,12 @@ if action == 'send_message':
|
||||
m = re.search(r'(git@[\w.]+:[\w./-]+\.git|https?://[\w./-]+\.git)', cmd)
|
||||
repo_url = m.group(0)
|
||||
rest = cmd[m.end():].strip()
|
||||
target = rest.split()[0] if rest else ''
|
||||
# target 只接受合法路径片段(字母数字/-_.),拒绝中文
|
||||
target = ''
|
||||
if rest:
|
||||
first_token = rest.split()[0] if rest.split() else ''
|
||||
if first_token and re.match(r'^[a-zA-Z0-9/_.-]+$', first_token):
|
||||
target = first_token
|
||||
if target and not target.startswith('-'):
|
||||
repo_target = target
|
||||
cmd = f'git clone {repo_url} {target}'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user