Browse Source

[ui] Also patch another jquery.notify plugin (#2006)

Fix bug using _this and not this.
Make sure we check the message post XSS and tags stripping.
Romain Rigaux 4 years ago
parent
commit
1095d02508

+ 2 - 2
desktop/core/src/desktop/js/jquery/plugins/jquery.notify.js

@@ -53,8 +53,8 @@ Plugin.prototype.show = function () {
   _this.options.message = _this.options.message.replace(/(<([^>]+)>)/gi, ''); // escape HTML messages
   _this.options.message = hueUtils.deXSS(_this.options.message); // escape XSS messages
 
-  if (/^(504|upstream connect error)/.test(this.options.message)) {
-    console.warn(this.options.message);
+  if (/^(504|upstream connect error|Gateway Time-out)/.test(_this.options.message.trim())) {
+    console.warn(_this.options.message);
     return;
   }
 

+ 5 - 0
desktop/core/src/desktop/static/desktop/js/jquery.notify.js

@@ -48,6 +48,11 @@
     var _this = this;
     var MARGIN = 4;
 
+    if (/^(504|upstream connect error|Gateway Time-out)/.test(_this.options.message.trim())) {
+      console.warn(_this.options.message);
+      return;
+    }
+
     _this.options.message = _this.options.message.replace(/(<([^>]+)>)/ig, ''); // escape HTML messages
     _this.options.message = hueUtils.deXSS(_this.options.message); // escape XSS messages