修复"打包文件时会将整个完整路径结构塞进压缩包内"问题

*之前没怎么注意这个问题
This commit is contained in:
Chenx221 2024-04-11 18:05:59 +08:00
parent b3f7cd6f45
commit 160367c160
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021

View File

@ -594,7 +594,7 @@ class HomeController extends Controller
if (!file_exists($absolutePath)) { if (!file_exists($absolutePath)) {
throw new NotFoundHttpException('The requested file does not exist.'); throw new NotFoundHttpException('The requested file does not exist.');
} }
$absolutePaths[] = $absolutePath; $absolutePaths[basename($absolutePath)] = $absolutePath;
} }
$zipPath = Yii::getAlias(Yii::$app->params['dataDirectory']) . '/' . Yii::$app->user->id . '/' . $targetDirectory . '/' . $model->zipFilename . '.' . $model->zipFormat; $zipPath = Yii::getAlias(Yii::$app->params['dataDirectory']) . '/' . Yii::$app->user->id . '/' . $targetDirectory . '/' . $model->zipFilename . '.' . $model->zipFormat;
try { try {