Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/DAV/WorkspacePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

use Exception;
use OC\Files\Node\File;
use OCA\DAV\Connector\Sabre\Directory;
use OCA\DAV\Files\FilesHome;
use OCA\Text\Service\ConfigService;
use OCA\Text\Service\WorkspaceService;
Expand Down Expand Up @@ -64,7 +63,7 @@ public function propFind(PropFind $propFind, INode $node) {
return;
}

if (!$node instanceof Directory && !$node instanceof FilesHome) {
if (!$node instanceof FilesHome) {
return;
}

Expand Down
18 changes: 6 additions & 12 deletions lib/Service/WorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

use OCP\Files\File;
use OCP\Files\Folder;
use OCP\Files\NotFoundException;
use OCP\Files\StorageInvalidException;
use OCP\IL10N;

class WorkspaceService {
Expand All @@ -28,17 +26,13 @@ public function __construct(IL10N $l10n) {
}

public function getFile(Folder $folder): ?File {
foreach ($this->getSupportedFilenames() as $filename) {
try {
$exists = $folder->getStorage()->getCache()->get($folder->getInternalPath() . '/' . $filename);
if ($exists) {
$file = $folder->get($filename);
if ($file instanceof File) {
return $file;
}
$content = $folder->getStorage()->getCache()->getFolderContents($folder->getInternalPath() . '/', 'text/markdown');
foreach ($content as $file) {
if (in_array($file->getName(), $this->getSupportedFilenames(), true)) {
$file = $folder->get($file->getPath());
if ($file instanceof File) {
return $file;
}
} catch (NotFoundException|StorageInvalidException) {
continue;
}
}
return null;
Expand Down
Loading