Skip to content

Commit

Permalink
Merge pull request #5298 from nanasess/fix-filemanager
Browse files Browse the repository at this point in the history
ファイル管理のファイル削除時、 select_file に空のパラメータを渡せないよう修正
  • Loading branch information
chihiro-adachi authored Feb 10, 2022
2 parents a32b54a + eefcc3f commit e28419c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Eccube/Controller/Admin/Content/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function delete(Request $request)
$this->isTokenValid();

$selectFile = $request->get('select_file');
if (is_null($selectFile) || $selectFile == '/') {
if ($selectFile === '' || $selectFile === null || $selectFile == '/') {
return $this->redirectToRoute('admin_content_file');
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Eccube/Tests/Web/Admin/Content/FileControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ public function testDelete()
$this->assertFalse(file_exists($filepath));
}

/**
* `select_file` が空の場合は `admin_content_file` へリダイレクトする.
*
* see https://github.com/EC-CUBE/ec-cube/pull/5298
*/
public function testDeleteWithEmpty()
{
$this->client->request(
'DELETE',
$this->generateUrl('admin_content_file_delete').'?select_file='
);
$this->assertTrue($this->client->getResponse()->isRedirect($this->generateUrl('admin_content_file')));
}

public function testIndexWithCreate()
{
$folder = 'create_folder';
Expand Down

0 comments on commit e28419c

Please sign in to comment.