mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-16 07:56:21 +00:00
fix: applet 压缩包名字(1).zip时 上传失败} (#12397)
Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
parent
dc56b019b1
commit
bc668f3e9f
@ -1,4 +1,6 @@
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import shutil
|
||||
import zipfile
|
||||
from typing import Callable
|
||||
@ -51,6 +53,11 @@ class DownloadUploadMixin:
|
||||
raise ValidationError({'error': _('Invalid zip file') + ': {}'.format(e)})
|
||||
|
||||
tmp_dir = os.path.join(extract_to, file.name.replace('.zip', ''))
|
||||
if not os.path.exists(tmp_dir):
|
||||
name = file.name
|
||||
name = re.match(r"(\w+)", name).group()
|
||||
tmp_dir = os.path.join(extract_to, name)
|
||||
|
||||
manifest = Applet.validate_pkg(tmp_dir)
|
||||
return manifest, tmp_dir
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user