Skip to content

Commit

Permalink
LPD-19992 Validate id and name fields according to spec
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-ortega committed Mar 15, 2024
1 parent 38f8da2 commit 2d2e4b5
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 677ae5062e15f2ce4339fae4cce5eca7ccb0dfb9 Mon Sep 17 00:00:00 2001
From 1ef4515f4817cfb1d6f81e491d3538ce95630d79 Mon Sep 17 00:00:00 2001
From: Julien Castelain <[email protected]>
Date: Tue, 14 May 2019 10:47:25 +0200
Subject: [PATCH] LPS-89596 Cannot Drag Image from top content line in IE11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 2fb3f3791a9e82255a3917e7dacd32051a8f1deb Mon Sep 17 00:00:00 2001
From 9db3dbc4aab97cdbbfddea51b105ee43db478c8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <[email protected]>
Date: Tue, 21 May 2019 09:38:15 +0200
Subject: [PATCH] LPS-95472 Tabs in popups not appears correctly in maximized
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9205e96f4ce990decc4d5b93286d3332accbf31f Mon Sep 17 00:00:00 2001
From 0292ac124a330ac582a75b34756d849af0e7316a Mon Sep 17 00:00:00 2001
From: Julien Castelain <[email protected]>
Date: Wed, 25 Mar 2020 12:58:15 +0100
Subject: [PATCH] LPS-85326 Remove check for Webkit browsers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 73e98738102ed6868d34da2ede641f95ed81d15b Mon Sep 17 00:00:00 2001
From 942aed4201647d554571d557b806e7475d298cde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <[email protected]>
Date: Tue, 14 Apr 2020 10:15:56 +0200
Subject: [PATCH] LPP-36989 Remove obsolete summary field from table elements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From ecb9ac9855c2934b0ad158340f5a2524f224e856 Mon Sep 17 00:00:00 2001
From 7983fb718bb9d2d7c29a1880c6d5a31380d2902c Mon Sep 17 00:00:00 2001
From: Julien Castelain <[email protected]>
Date: Tue, 7 Jul 2020 09:47:27 +0200
Subject: [PATCH] LPS-112982 Add additional resource URL parameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 67fc472af1861be4049272c33015138368b2d951 Mon Sep 17 00:00:00 2001
From 0677bd02e0e1d60aa7bf6b00d653753c3fead5ce Mon Sep 17 00:00:00 2001
From: Carlos Lancha <[email protected]>
Date: Thu, 6 Aug 2020 14:42:21 +0200
Subject: [PATCH] LPS-118624 Don't pass languageId to css files requests
Expand Down
2 changes: 1 addition & 1 deletion patches/0007-LPS-124728-Avoid-breaking-IE11.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 28d5de7bb90438c8825dac721d93a25730511a98 Mon Sep 17 00:00:00 2001
From 84d3daa5c9b00fa59ec15978a2c888d93f1a6cda Mon Sep 17 00:00:00 2001
From: Julien Castelain <[email protected]>
Date: Mon, 21 Dec 2020 09:12:53 +0100
Subject: [PATCH] LPS-124728 Avoid breaking IE11
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 07e1d151f387e0eb33b277b8d5db1731d932be24 Mon Sep 17 00:00:00 2001
From 336001359acd4c8bc61419d9039ddef54a75eda0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roland=20P=C3=A1kai?= <[email protected]>
Date: Fri, 8 Jan 2021 10:58:23 +0100
Subject: [PATCH] LPS-125559 Fix width for the following fields Cell spacing,
Expand Down
2 changes: 1 addition & 1 deletion patches/0009-LPS-131699-Add-null-check.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3f6c78ed9d6ff409d0c738ec1e211e038454a0e7 Mon Sep 17 00:00:00 2001
From af4bb2e9e421ef3d1034f98e369a3e48d0ce5b76 Mon Sep 17 00:00:00 2001
From: IstvanD <[email protected]>
Date: Wed, 19 May 2021 17:43:17 +0200
Subject: [PATCH] LPS-131699 Add null check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 10216fb46ecdaed9c941a278fbea3ab080741684 Mon Sep 17 00:00:00 2001
From 7c5adca769384ed6495e28148789c82cc8193f89 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <[email protected]>
Date: Mon, 9 Aug 2021 18:04:44 +0200
Subject: [PATCH] LPS-136119 Set `id` on first render, instead of changing it
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 5eb566996d9d967f397e489e960f2239fd085103 Mon Sep 17 00:00:00 2001
From 79917297e641bf5fd3930f7397366d93e5751211 Mon Sep 17 00:00:00 2001
From: Norbert Nemeth <[email protected]>
Date: Tue, 17 Aug 2021 11:20:58 +0200
Subject: [PATCH] LPS-136998 Avoid breaking the UI in firefox
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9b5886854dc27f912cc8a97746c69bd7568c600d Mon Sep 17 00:00:00 2001
From db3a90ffce66ba561e4b944585e0ded441626fb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <[email protected]>
Date: Mon, 16 Aug 2021 18:36:20 +0200
Subject: [PATCH] LPS-137425 Don't check selection on focus
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 803da67e1fb33c2dda80e4cf4e9e5cae5b588cfd Mon Sep 17 00:00:00 2001
From 96dc0b60767717079d0d9a1ffa8cae2849f25564 Mon Sep 17 00:00:00 2001
From: Minhchau <[email protected]>
Date: Tue, 28 Sep 2021 11:18:40 -0700
Subject: [PATCH] LPS-139565 When upgrading from 6.2 to 7.1, image width/height
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 3bbd5875ca90cb312ab635c7d35e7eed094d0be8 Mon Sep 17 00:00:00 2001
From b65cde0db7ad3271b8b6f5be231485d5b362c699 Mon Sep 17 00:00:00 2001
From: Diego Nascimento <[email protected]>
Date: Mon, 18 Oct 2021 17:45:43 -0300
Subject: [PATCH] LPS-137763 If contentsElement is defined, use it as a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d7a2cf65337479f2888235add5ffa1817bb60b47 Mon Sep 17 00:00:00 2001
From bc9a890fcb94a4edc0a9aa0f53bcf4ded63f14cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20=C4=8Ciko=C5=A1?= <[email protected]>
Date: Fri, 21 Oct 2022 15:28:58 +0200
Subject: [PATCH] LPS-166086 Make dialog close button accessible with keyboard
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 99941c63a380b2de53182e73a0adb615fcf9618c Mon Sep 17 00:00:00 2001
From: Antonio Ortega <[email protected]>
Date: Fri, 15 Mar 2024 16:01:20 +0100
Subject: [PATCH] LPD-19992 Validate id and name fields according to spec

---
plugins/link/dialogs/link.js | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/plugins/link/dialogs/link.js b/plugins/link/dialogs/link.js
index 46e452e741..39932fd2d9 100755
--- a/plugins/link/dialogs/link.js
+++ b/plugins/link/dialogs/link.js
@@ -1010,7 +1010,18 @@

this.setupContent( data );
},
- onOk: function() {
+ onOk: function(event) {
+ var idValue = this.getValueOf('advanced', 'advId');
+ var nameValue = this.getValueOf('advanced', 'advName');
+
+ if (
+ !validateField('id', idValue) ||
+ !validateField('name', nameValue)
+ ) {
+ event.data.hide = false;
+ return;
+ }
+
var data = {};

// Collect data from fields.
@@ -1046,6 +1057,23 @@
};
} );

+ function validateField(fieldName, fieldValue) {
+ var regEx = /^[A-Za-z]+[\w\-:.]*$/;
+
+ if (fieldValue && !regEx.test(fieldValue)) {
+ alert(
+ Liferay.Util.sub(
+ Liferay.Language.get('there-was-an-error-when-loading-the-x-field'),
+ fieldName
+ )
+ );
+
+ return false;
+ }
+
+ return true;
+ }
+
function validateTelNumber() {
var dialog = this.getDialog(),
editor = dialog._.editor,

0 comments on commit 2d2e4b5

Please sign in to comment.