修复解压后未正确跳转的bug
This commit is contained in:
parent
535498811b
commit
6fa99f08b5
@ -599,8 +599,8 @@ class HomeController extends Controller
|
|||||||
if ($archive === null) {
|
if ($archive === null) {
|
||||||
throw new NotFoundHttpException('Failed to open the archive.');
|
throw new NotFoundHttpException('Failed to open the archive.');
|
||||||
}
|
}
|
||||||
|
$now_time = time();
|
||||||
$targetDirectory = Yii::getAlias(Yii::$app->params['dataDirectory']) . '/' . Yii::$app->user->id . '/' . pathinfo($relativePath, PATHINFO_FILENAME) . '_' . time();
|
$targetDirectory = Yii::getAlias(Yii::$app->params['dataDirectory']) . '/' . Yii::$app->user->id . '/' . pathinfo($relativePath, PATHINFO_FILENAME) . '_' . $now_time;
|
||||||
if (!is_dir($targetDirectory)) {
|
if (!is_dir($targetDirectory)) {
|
||||||
mkdir($targetDirectory, 0777, true);
|
mkdir($targetDirectory, 0777, true);
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ class HomeController extends Controller
|
|||||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||||
return [
|
return [
|
||||||
'status' => 200,
|
'status' => 200,
|
||||||
'directory' => pathinfo($relativePath, PATHINFO_FILENAME) . '_' . time(),
|
'directory' => pathinfo($relativePath, PATHINFO_FILENAME) . '_' . $now_time,
|
||||||
];
|
];
|
||||||
} catch (ArchiveExtractionException) {
|
} catch (ArchiveExtractionException) {
|
||||||
$this->deleteDirectory($targetDirectory);
|
$this->deleteDirectory($targetDirectory);
|
||||||
@ -619,7 +619,7 @@ class HomeController extends Controller
|
|||||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
Yii::$app->response->format = Response::FORMAT_JSON;
|
||||||
return [
|
return [
|
||||||
'status' => 500,
|
'status' => 500,
|
||||||
'directory' => pathinfo($relativePath, PATHINFO_FILENAME) . '_' . time(),
|
'directory' => pathinfo($relativePath, PATHINFO_FILENAME) . '_' . $now_time,
|
||||||
'parentDirectory' => dirname($relativePath),
|
'parentDirectory' => dirname($relativePath),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user