Remove unused legacy ajax/list.php in files app

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
pull/35980/head
Vincent Petry 1 year ago
parent 79f1c30a31
commit 42d9e087fb
No known key found for this signature in database
GPG Key ID: E055D6A4D513575C

@ -1,108 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Lukas Reschke <lukas@statuscode.ch>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Vincent Petry <vincent@nextcloud.com>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
use OCP\Files\StorageNotAvailableException;
use OCP\Files\StorageInvalidException;
\OC_JSON::checkLoggedIn();
\OC::$server->getSession()->close();
$l = \OC::$server->getL10N('files');
// Load the files
$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
$dir = \OC\Files\Filesystem::normalizePath($dir);
try {
$dirInfo = \OC\Files\Filesystem::getFileInfo($dir);
if (!$dirInfo || $dirInfo->getType() !== 'dir') {
http_response_code(404);
exit();
}
$data = [];
$baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir=';
$permissions = $dirInfo->getPermissions();
$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
$sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
$mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : '';
$files = [];
// Clean up duplicates from array
if (is_array($mimetypeFilters) && count($mimetypeFilters)) {
$mimetypeFilters = array_unique($mimetypeFilters);
if (!in_array('httpd/unix-directory', $mimetypeFilters)) {
// append folder filter to be able to browse folders
$mimetypeFilters[] = 'httpd/unix-directory';
}
// create filelist with mimetype filter - as getFiles only supports on
// mimetype filter at once we will filter this folder for each
// mimetypeFilter
foreach ($mimetypeFilters as $mimetypeFilter) {
$files = array_merge($files, \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection, $mimetypeFilter));
}
// sort the files accordingly
$files = \OCA\Files\Helper::sortFiles($files, $sortAttribute, $sortDirection);
} else {
// create file list without mimetype filter
$files = \OCA\Files\Helper::getFiles($dir, $sortAttribute, $sortDirection);
}
$data['directory'] = $dir;
$data['files'] = \OCA\Files\Helper::formatFileInfos($files);
$data['permissions'] = $permissions;
\OC_JSON::success(['data' => $data]);
} catch (\OCP\Files\StorageNotAvailableException $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
\OC_JSON::error([
'data' => [
'exception' => StorageNotAvailableException::class,
'message' => $l->t('Storage is temporarily not available')
]
]);
} catch (\OCP\Files\StorageInvalidException $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
\OC_JSON::error([
'data' => [
'exception' => StorageInvalidException::class,
'message' => $l->t('Storage invalid')
]
]);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, ['app' => 'files']);
\OC_JSON::error([
'data' => [
'exception' => \Exception::class,
'message' => $l->t('Unknown error')
]
]);
}

@ -43,8 +43,6 @@ use OCA\Files\Controller\OpenLocalEditorController;
/** @var $this \OC\Route\Router */
$this->create('files_ajax_download', 'apps/files/ajax/download.php')
->actionInclude('files/ajax/download.php');
$this->create('files_ajax_list', 'apps/files/ajax/list.php')
->actionInclude('files/ajax/list.php');
/** @var Application $application */
$application = \OC::$server->query(Application::class);

@ -1116,19 +1116,6 @@ const Dialogs = {
}
return defer.promise()
},
_getFileList: function(dir, mimeType) { // this is only used by the spreedme app atm
if (typeof (mimeType) === 'string') {
mimeType = [mimeType]
}
return $.getJSON(
OC.filePath('files', 'ajax', 'list.php'),
{
dir: dir,
mimetypes: JSON.stringify(mimeType)
}
)
},
/**
* fills the filepicker with files

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/core-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -43,9 +43,6 @@ class RouterTest extends TestCase {
// the OCS route is the prefixed one for the AppFramework - see /ocs/v1.php for routing details
$this->assertEquals('/index.php/ocsapp/apps/dav/api/v1/direct', $router->generate('ocs.dav.direct.getUrl'));
// special route name - should load all apps and then find the route
$this->assertEquals('/index.php/apps/files/ajax/list.php', $router->generate('files_ajax_list'));
// test caching
$this->assertEquals('/index.php/apps/files/', $router->generate('files.view.index'));
}

@ -119,16 +119,16 @@ class UrlGeneratorTest extends \Test\TestCase {
public function provideDocRootAppUrlParts() {
return [
['files', 'ajax/list.php', [], '/index.php/apps/files/ajax/list.php'],
['files', 'ajax/list.php', ['trut' => 'trat', 'dut' => 'dat'], '/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'],
['files', 'ajax/download.php', [], '/index.php/apps/files/ajax/download.php'],
['files', 'ajax/download.php', ['trut' => 'trat', 'dut' => 'dat'], '/index.php/apps/files/ajax/download.php?trut=trat&dut=dat'],
['', 'index.php', ['trut' => 'trat', 'dut' => 'dat'], '/index.php?trut=trat&dut=dat'],
];
}
public function provideSubDirAppUrlParts() {
return [
['files', 'ajax/list.php', [], '/nextcloud/index.php/apps/files/ajax/list.php'],
['files', 'ajax/list.php', ['trut' => 'trat', 'dut' => 'dat'], '/nextcloud/index.php/apps/files/ajax/list.php?trut=trat&dut=dat'],
['files', 'ajax/download.php', [], '/nextcloud/index.php/apps/files/ajax/download.php'],
['files', 'ajax/download.php', ['trut' => 'trat', 'dut' => 'dat'], '/nextcloud/index.php/apps/files/ajax/download.php?trut=trat&dut=dat'],
['', 'index.php', ['trut' => 'trat', 'dut' => 'dat'], '/nextcloud/index.php?trut=trat&dut=dat'],
];
}

Loading…
Cancel
Save