[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Calendar: Display pipes, colons and less than symbols in the event title

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <688b759522fc7_2c313dff024471@gitlab-sidekiq-low-urgency-cpu-bound-v2-d9455d4c6-jclv6.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
091099d3 by Adrien Mbuya Maloba at 2025-07-31T13:46:18+00:00
[FIX] Calendar: Display pipes, colons and less than symbols in the event title
---
* [FIX] Calendar: Display pipes, colons and less than symbols in the event title

See merge request tikiwiki/tiki!8033

- - - - -


2 changed files:

- lib/jquery_tiki/tiki-jquery.js
- src/js/jquery-tiki/tiki-calendar.js


Changes:

=====================================
lib/jquery_tiki/tiki-jquery.js
=====================================
@@ -4344,3 +4344,10 @@ function downloadBase64ImageAsFile(dataUrl, fileName = null) {
     document.body.removeChild(link);
     URL.revokeObjectURL(blobUrl);
 }
+
+// Escaping any pipes (|), colons (:) and less than symboles (<) which can be used as special characters for the tooltip
+// Use to escape characters for the event calendar tooltip
+function tooltipEscape(title) {
+    const escapedTitle = title.replace(/\|/g, "&#124;").replace(/\:/g, "&colon;").replace(/\</g, "&lt;");
+    return escapedTitle;
+}


=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -190,7 +190,8 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
                         });
                     }
                 }
-                element.attr("title", event.title + "|" + event.extendedProps.description);
+                const eventTitle = tooltipEscape(event.title);
+                element.attr("title", eventTitle + "|" + event.extendedProps.description);
                 element.addClass("tips");
                 // surely there's a better way?
                 $(element).parent().tiki_popover();



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/091099d315c8a46ff9f6e75faa1176f225b42b2c

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/091099d315c8a46ff9f6e75faa1176f225b42b2c
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.