From d67b0c81692f94ed6f0b4454a8445b9c23f1c3f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Fri, 17 Mar 2023 11:46:09 +0100
Subject: [PATCH] add error to invalid sass

---
 app/models/communication/extranet/with_style.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/models/communication/extranet/with_style.rb b/app/models/communication/extranet/with_style.rb
index cb8709cd2..d4ccf9414 100644
--- a/app/models/communication/extranet/with_style.rb
+++ b/app/models/communication/extranet/with_style.rb
@@ -8,6 +8,10 @@ module Communication::Extranet::WithStyle
   protected
 
   def generate_css
-    self.css = SassC::Engine.new(sass, syntax: :sass, style: :compressed).render
+    begin
+      self.css = SassC::Engine.new(sass, syntax: :sass, style: :compressed).render
+    rescue SassC::SyntaxError
+      errors.add(:sass, :invalid)
+    end
   end
 end
\ No newline at end of file
-- 
GitLab