Example #1
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * Shows the albums and pictures or download the single file the token gives access to
  *
  * @param string $token
  * @param null|string $filename
  *
  * @return TemplateResponse|ImageResponse|RedirectResponse
  */
 public function publicIndex($token, $filename)
 {
     $node = $this->environment->getSharedNode();
     if ($node->getType() === 'dir') {
         return $this->showPublicPage($token);
     } else {
         return $this->downloadFile($node, $filename);
     }
 }
Example #2
0
 /**
  * @PublicPage
  * @NoCSRFRequired
  *
  * Shows the albums and pictures or redirects to the download location the token gives access to
  *
  * @param string $token
  * @param null|string $filename
  *
  * @return TemplateResponse|ImageResponse|RedirectResponse
  */
 public function publicIndex($token, $filename)
 {
     $node = $this->environment->getSharedNode();
     if ($node->getType() === 'dir') {
         return $this->showPublicPage($token);
     } else {
         $url = $this->urlGenerator->linkToRoute($this->appName . '.files_public.download', ['token' => $token, 'fileId' => $node->getId(), 'filename' => $filename]);
         return new RedirectResponse($url);
     }
 }