cloud-ide-element 1.1.129 → 1.1.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -902,11 +902,17 @@ class CideInputComponent {
|
|
|
902
902
|
}
|
|
903
903
|
else if (this.type == 'url') {
|
|
904
904
|
if (typeof (value) == 'string' && value) {
|
|
905
|
-
// URL validation regex
|
|
906
|
-
|
|
905
|
+
// URL validation regex - allows URLs with or without TLD (e.g., http://localhost or http://example.com)
|
|
906
|
+
// Pattern breakdown:
|
|
907
|
+
// - ^https?:\/\/ - protocol (http:// or https://)
|
|
908
|
+
// - (www\.)? - optional www. prefix
|
|
909
|
+
// - [-a-zA-Z0-9@:%._\+~#=]{1,256} - hostname (allows localhost, IP addresses, domain names with/without TLD)
|
|
910
|
+
// - (:\d+)? - optional port number
|
|
911
|
+
// - (\/[-a-zA-Z0-9()@:%_\+.~#?&//=]*)? - optional path, query params, and hash
|
|
912
|
+
const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}(:\d+)?(\/[-a-zA-Z0-9()@:%_\+.~#?&//=]*)?$/;
|
|
907
913
|
if (!urlRegex.test(value)) {
|
|
908
914
|
validation_status.status = true;
|
|
909
|
-
validation_status.validation.required = `Please enter a valid URL (e.g., https://example.com)!`;
|
|
915
|
+
validation_status.validation.required = `Please enter a valid URL (e.g., https://example.com or http://localhost)!`;
|
|
910
916
|
}
|
|
911
917
|
if (this.maxlength > 0) {
|
|
912
918
|
if (value?.length > this.maxlength) {
|