Skip to content
Snippets Groups Projects
Commit 429b1b22 authored by Sebastien's avatar Sebastien
Browse files

Block access to the capsule preview if the capsule doesn't exist

parent 67b45943
No related branches found
No related tags found
3 merge requests!43tuleap-83-access-my-capsules,!42Draft: access-my-capsules-conflicts-fixed,!40Draft: Tuleap 83 access my capsules
Pipeline #700 passed
......@@ -85,6 +85,11 @@ class CapsuleController extends AbstractController
*/
public function preview(string $path): Response
{
$file_path = '../legacy/' . $path;
if (!file_exists($file_path)) {
return $this->render('capsule/capsule_not_found.html.twig');
}
$url = $this->getParameter('app.legacy_external_prefix') . '/' . $path . "/?w=1";
return $this->render(
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}MemoRekall{% endblock %}</title>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
{% block javascripts %}
{{ encore_entry_script_tags('app') }}
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('build/images/favicon.ico') }}" />
</head>
<body class="container col-10 col-md-8 col-lg-6 m-auto">
<div class="position-relative d-flex flex-row align-items-center justify-content-center mb-5">
<img id="header-memorekall-logo" class="memorekall-logo" src="{{ asset('build/images/MemoRekall.png') }}">
</div>
<div class="m-auto d-flex flex-row align-items-center justify-content-center mb-5 alert alert-warning" role="status">
<span class="p-5">{{ 'capsule.not_found' | trans }}</span>
</div>
</body>
</html>
......@@ -53,6 +53,7 @@ capsule:
no_edition_access: No edition access
edition_not_allowed: You are not allowed to edit this capsule
contact_capsule_author_for_access: Please contact the author to gain access the edition mode
not_found: The capsule doesn't exist
project:
already_exists: Project capsule_name already exists so the capsule could not be created
......
......@@ -52,6 +52,7 @@ capsule:
no_edition_access: Pas d'accès au mode édition
edition_not_allowed: Vous n'êtes pas autorisé a modifier cette capsule
contact_capsule_author_for_access: Veuillez contacter l'auteur de la capsule pour lui demander son accès en mode édition
not_found: La capsule n'existe pas
project:
already_exists: Le projet capsule_name existe déjà. La capsule n'a pas pu être créée
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment