fix(web/problem/manage/data): condition for subfolder
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-11-08 15:27:48 +08:00
parent 6b785e8bc7
commit 33779b1758
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -59,7 +59,7 @@ if ($_POST['problem_data_file_submit'] == 'submit') {
if ($zip->open($up_filename) === TRUE) { if ($zip->open($up_filename) === TRUE) {
$zip->extractTo("/var/uoj_data/upload/{$problem['id']}"); $zip->extractTo("/var/uoj_data/upload/{$problem['id']}");
$zip->close(); $zip->close();
exec("cd /var/uoj_data/upload/{$problem['id']}; if [ `find . -maxdepth 1 -type f`File = File ]; then for sub_dir in `find -maxdepth 1 -type d ! -name .`; do mv -f \$sub_dir/* . && rm -rf \$sub_dir; done; fi"); exec("cd /var/uoj_data/upload/{$problem['id']}; if [ -z "`find . -maxdepth 1 -type f`" ]; then for sub_dir in `find -maxdepth 1 -type d ! -name .`; do mv -f \$sub_dir/* . && rm -rf \$sub_dir; done; fi");
echo "<script>alert('上传成功!')</script>"; echo "<script>alert('上传成功!')</script>";
} else { } else {
$errmsg = "解压失败!"; $errmsg = "解压失败!";