зеркало из https://github.com/nextcloud/text.git
Use full list of supported filenames when obtaining the name to create
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Родитель
380e7a6d2a
Коммит
732da03d72
|
@ -85,11 +85,6 @@ class WorkspaceController extends OCSController {
|
||||||
/** @var IURLGenerator */
|
/** @var IURLGenerator */
|
||||||
private $urlGenerator;
|
private $urlGenerator;
|
||||||
|
|
||||||
private const SUPPORTED_FILENAMES = [
|
|
||||||
'README.md',
|
|
||||||
'Readme.md',
|
|
||||||
'readme.md'
|
|
||||||
];
|
|
||||||
/** @var IEventDispatcher */
|
/** @var IEventDispatcher */
|
||||||
private $eventDispatcher;
|
private $eventDispatcher;
|
||||||
|
|
||||||
|
@ -184,7 +179,7 @@ class WorkspaceController extends OCSController {
|
||||||
if ($folder instanceof Folder) {
|
if ($folder instanceof Folder) {
|
||||||
$file = $this->getFile($folder);
|
$file = $this->getFile($folder);
|
||||||
if ($file === null) {
|
if ($file === null) {
|
||||||
$token = $this->directEditingManager->create($path . '/'. self::SUPPORTED_FILENAMES[0], Application::APP_NAME, 'textdocument');
|
$token = $this->directEditingManager->create($path . '/'. $this->workspaceService->getSupportedFilenames()[0], Application::APP_NAME, 'textdocument');
|
||||||
} else {
|
} else {
|
||||||
$token = $this->directEditingManager->open($path . '/'. $file->getName(), Application::APP_NAME);
|
$token = $this->directEditingManager->open($path . '/'. $file->getName(), Application::APP_NAME);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +196,7 @@ class WorkspaceController extends OCSController {
|
||||||
|
|
||||||
private function getFile(Folder $folder) {
|
private function getFile(Folder $folder) {
|
||||||
$file = null;
|
$file = null;
|
||||||
foreach (self::SUPPORTED_FILENAMES as $filename) {
|
foreach ($this->workspaceService->getSupportedFilenames() as $filename) {
|
||||||
if ($folder->nodeExists($filename)) {
|
if ($folder->nodeExists($filename)) {
|
||||||
$file = $folder->get($filename);
|
$file = $folder->get($filename);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class WorkspaceService {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSupportedFilenames() {
|
public function getSupportedFilenames() {
|
||||||
return array_merge([
|
return array_merge([
|
||||||
$this->l10n->t('Readme') . '.md'
|
$this->l10n->t('Readme') . '.md'
|
||||||
], self::SUPPORTED_STATIC_FILENAMES);
|
], self::SUPPORTED_STATIC_FILENAMES);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче