diff options
author | PhieF <phie@phie.ovh> | 2021-05-09 11:34:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 11:34:09 +0300 |
commit | 23444f0e1fd1fe2beeb42322ce5539ba847affc6 (patch) | |
tree | 6a1d45e62d3a0176003dcd5467ecbf931c679c4d | |
parent | e9b36fc1a1238dbe1a8e00237243b34d844545de (diff) | |
parent | e212bdc18c6cd23d9992d3876495d6ddefc94c74 (diff) |
Merge pull request #154 from yamanq/yamanq/export
Fix "Export all notes" button
-rwxr-xr-x | lib/Controller/NoteController.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 729babb..a87e9d6 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -11,6 +11,7 @@ use OCA\Carnet\Misc\NoteUtils; use OCA\Carnet\Misc\CacheManager; use OCP\IDBConnection; + use OCP\IURLGenerator; use OCA\Carnet\Misc\Search; //require_once 'vendor/autoload.php'; function endsWith($string, $endString) @@ -35,20 +36,21 @@ return $this->inputStream; } } - $test = "bla"; class NoteController extends Controller { private $userId; private $bla; private $storage; private $CarnetFolder; private $db; + private $urlGenerator; public static $lastWrite = null; - public function __construct($AppName, IRequest $request, $UserId, $RootFolder, $Config, IDBConnection $IDBConnection){ + public function __construct($AppName, IRequest $request, $UserId, $RootFolder, $Config, IDBConnection $IDBConnection, IURLGenerator $urlGenerator){ parent::__construct($AppName, $request); $this->userId = $UserId; $this->db = $IDBConnection; $this->Config = $Config; $this->rootFolder = $RootFolder; + $this->urlGenerator = $urlGenerator; $folder = $this->Config->getUserValue($this->userId, $this->appName, "note_folder"); //$this->Config->setUserValue($this->userId, $this->appName, "note_folder", 'Documents/QuickNote'); if(empty($folder)) @@ -1307,12 +1309,7 @@ public function getOpusEncoder(){ * @NoCSRFRequired */ public function downloadArchive(){ - $tmp = substr($_SERVER['REQUEST_URI'],1); - $tmp = strchr($tmp,"/", "true"); - if ($tmp == "index.php") { - $tmp = ""; - } - return new RedirectResponse("../../../../../../".$tmp."/index.php/apps/files/ajax/download.php?files=".$this->getNotePath()); + return new RedirectResponse($this->urlGenerator->getBaseUrl()."/index.php/apps/files/ajax/download.php?files=".$this->getNotePath()); } |