diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php
index d8484389..a7ea2319 100644
--- a/lib/Controller/ApiBase.php
+++ b/lib/Controller/ApiBase.php
@@ -114,36 +114,34 @@ class ApiBase extends Controller
// Anything else needs a user
$user = $this->userSession->getUser();
if (null === $user) {
- return null;
+ throw new \Exception('User not logged in');
}
$uid = $user->getUID();
$folder = null;
$folderPath = $this->request->getParam('folder');
- $forcedTimelinePath = $this->request->getParam('timelinePath');
$userFolder = $this->rootFolder->getUserFolder($uid);
- if (null !== $folderPath) {
- $folder = $userFolder->get($folderPath);
- } elseif (null !== $forcedTimelinePath) {
- $folder = $userFolder->get($forcedTimelinePath);
- } else {
- $configPath = Exif::removeExtraSlash(Exif::getPhotosPath($this->config, $uid));
- $folder = $userFolder->get($configPath);
- }
+ try {
+ if (null !== $folderPath) {
+ $folder = $userFolder->get(Exif::removeExtraSlash($folderPath));
+ $root->addFolder($folder);
+ } else {
+ $timelinePath = $this->request->getParam('timelinePath', Exif::getPhotosPath($this->config, $uid));
+ $timelinePath = Exif::removeExtraSlash($timelinePath);
- if (!$folder instanceof Folder) {
- throw new \Exception('Folder not found');
- }
+ // Multiple timeline path support
+ $paths = explode(';', $timelinePath);
+ foreach ($paths as &$path) {
+ $folder = $userFolder->get(trim($path));
+ $root->addFolder($folder);
+ }
+ $root->addMountPoints();
+ }
+ } catch (\OCP\Files\NotFoundException $e) {
+ $msg = $e->getMessage();
- if (!($folder->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
- throw new \Exception('Folder not readable');
- }
-
- // Don't add mount points for folder view
- $root->addFolder($folder);
- if (null === $folderPath) {
- $root->addMountPoints();
+ throw new \Exception("Folder not found: {$msg}");
}
return $root;
diff --git a/lib/Db/TimelineQueryDays.php b/lib/Db/TimelineQueryDays.php
index 40526edf..5e5ce948 100644
--- a/lib/Db/TimelineQueryDays.php
+++ b/lib/Db/TimelineQueryDays.php
@@ -242,7 +242,8 @@ trait TimelineQueryDays
$tmp = $actualPath[1];
$actualPath[1] = $actualPath[2];
$actualPath[2] = $tmp;
- $davPaths[$fileid] = implode('/', $actualPath);
+ $davPath = implode('/', $actualPath);
+ $davPaths[$fileid] = \OCA\Memories\Exif::removeExtraSlash('/'.$davPath.'/');
}
}
}
@@ -270,7 +271,7 @@ trait TimelineQueryDays
// Check if path exists and starts with basePath and remove
if (isset($row['path']) && !empty($row['path'])) {
$rootId = $row['rootid'] ?: $defaultRootId;
- $basePath = $internalPaths[$rootId] ?: '#__#';
+ $basePath = $internalPaths[$rootId] ?? '#__#';
$davPath = $davPaths[$rootId] ?: '';
if (0 === strpos($row['path'], $basePath)) {
diff --git a/lib/Db/TimelineRoot.php b/lib/Db/TimelineRoot.php
index 04490a73..fc6b8f52 100644
--- a/lib/Db/TimelineRoot.php
+++ b/lib/Db/TimelineRoot.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace OCA\Memories\Db;
use OCP\Files\Folder;
+use OCP\Files\Node;
class TimelineRoot
{
@@ -16,11 +17,27 @@ class TimelineRoot
{
}
- public function addFolder(Folder &$folder)
+ /**
+ * Add a folder to the root.
+ *
+ * @param Node $folder Node to add
+ *
+ * @throws \Exception if node is not valid readable folder
+ */
+ public function addFolder(Node &$folder)
{
+ $folderPath = $folder->getPath();
+
+ if (!$folder instanceof Folder) {
+ throw new \Exception("Not a folder: {$folderPath}");
+ }
+
+ if (!($folder->getPermissions() & \OCP\Constants::PERMISSION_READ)) {
+ throw new \Exception("Folder not readable: {$folderPath}");
+ }
+
// Add top level folder
$id = $folder->getId();
- $folderPath = $folder->getPath();
$this->folders[$id] = $folder;
$this->folderPaths[$id] = $folderPath;
}
diff --git a/src/components/Settings.vue b/src/components/Settings.vue
index ecbc95f0..1d13d705 100644
--- a/src/components/Settings.vue
+++ b/src/components/Settings.vue
@@ -53,6 +53,12 @@
>
{{ t("memories", "Square grid mode") }}
+
+
@@ -65,18 +71,24 @@ input[type="text"] {
+
+