diff --git a/lib/Controller/MainController.php b/lib/Controller/MainController.php index dbbb991..0e049bc 100644 --- a/lib/Controller/MainController.php +++ b/lib/Controller/MainController.php @@ -27,6 +27,7 @@ class MainController extends Controller public function __construct($appName, IRequest $request, $UserId, IL10N $IL10N, Aria2 $aria2, Youtube $youtube) { + parent::__construct($appName, $request); $this->appName = $appName; $this->uid = $UserId; diff --git a/lib/Tools/Helper.php b/lib/Tools/Helper.php index 6941290..dfb7af3 100644 --- a/lib/Tools/Helper.php +++ b/lib/Tools/Helper.php @@ -392,14 +392,16 @@ class Helper public static function getLocalFolder(string $path): string { - //without calling this, filesystem::getLocalFolder doesn't work - OC_Util::setupFS(); - return Filesystem::getLocalFolder($path); + if (self::getUID()) { + OC_Util::setupFS(); + return Filesystem::getLocalFolder($path); + } + return ""; } public static function getRealDownloadDir($uid = null): string { - $dlDir = self::getDownloadDir();; + $dlDir = self::getDownloadDir(); return self::getLocalFolder($dlDir); } public static function getRealTorrentsDir($uid = null): string @@ -415,7 +417,9 @@ class Helper public static function getUID(): string { - return self::getUser()->getUID(); + $user = self::getUser(); + $uid = $user ? $user->getUID() : ""; + return $uid; } public static function getSettings($key, $default = null, int $type = Settings::TYPE['USER'])