Skip to content

Commit 1a232d6

Browse files
Shrikha .ci-build
authored andcommitted
FORMS-16007: incorporating the review comments
1 parent e7ceec5 commit 1a232d6

File tree

1 file changed

+8
-6
lines changed
  • ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v1/container/clientlibs/editor/js

1 file changed

+8
-6
lines changed

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/container/v1/container/clientlibs/editor/js/editDialog.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@
367367
restEndPointUrlTextBox = Utils.selectElement("input", './restEndpointPostUrl')[0],
368368
restEndpointConfigPath = Utils.selectElement("input", './restEndpointConfigPath')[0];
369369

370-
if (!enableRestEndpointCheckboxElement) return;
371-
372370
if (enableRestEndpointCheckboxElement != null && enableRestEndpointCheckboxElement.checked == true) {
373371
restEndPointSource.parent('div').parent('div').show();
374372
Utils.showComponent(restEndPointSource, 'div');
@@ -498,12 +496,16 @@
498496
function registerRestEndpointUrlValidator() {
499497
$(window).adaptTo("foundation-registry").register("foundation.validation.validator", {
500498
selector: "[data-rest-endpoint-url-validation]",
501-
validate: function(el) {
502-
var url = el.value;
503-
var absoluteUrlPattern = /^(?:[a-z]+:)?\/\//i; // Pattern to match absolute URLs
499+
validate: (el) => {
500+
const url = el.value;
501+
502+
// Regex to validate absolute URLs starting with http:// or https:// only
503+
const absoluteUrlPattern = /^(https?:\/\/)([a-z0-9\-]+\.)*[a-z0-9\-]+(\.[a-z]{2,})(:[0-9]{1,5})?(\/.*)?$/i;
504504

505505
if (!absoluteUrlPattern.test(url)) {
506-
return Granite.I18n.getMessage("Enter a valid URL for the POST request. Ensure the URL starts with 'https://' or 'http://' and follows this structure: https://www.server.com/path/to/resource");
506+
return Granite.I18n.getMessage(
507+
"Enter a valid URL for the POST request. Ensure the URL starts with 'https://' or 'http://' and follows this structure: https://www.server.com/path/to/resource"
508+
);
507509
}
508510
}
509511
});

0 commit comments

Comments
 (0)