]> cat aescling's git repositories - mastodon.git/commitdiff
Fix web push notifications containing HTML entities (#18071)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 23 Apr 2022 19:47:43 +0000 (21:47 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Thu, 5 May 2022 03:56:00 +0000 (23:56 -0400)
app/serializers/web/notification_serializer.rb

index ee83ec8b26e7e46376ca490be9f131a0af5b5f41..c5a908b199fb6ce24b9f8e09682c0eb7c7a30e50 100644 (file)
@@ -34,6 +34,6 @@ class Web::NotificationSerializer < ActiveModel::Serializer
 
   def body
     str = strip_tags(object.target_status&.spoiler_text&.presence || object.target_status&.text || object.from_account.note)
-    truncate(HTMLEntities.new.decode(str.to_str), length: 140) # Do not encode entities, since this value will not be used in HTML
+    truncate(HTMLEntities.new.decode(str.to_str), length: 140, escape: false) # Do not encode entities, since this value will not be used in HTML
   end
 end