Просмотр исходного кода

Merge pull request #21721 from netbox-community/21698-custom-field-url-filter-is-too-restrictive-for-weird-ports

Fixes #21698: Fix validation of custom field URLs with single-digit ports
bctiemann 1 день назад
Родитель
Сommit
d497198f49
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      netbox/utilities/validators.py

+ 1 - 1
netbox/utilities/validators.py

@@ -34,7 +34,7 @@ class EnhancedURLValidator(URLValidator):
         r'^(?:[a-z0-9\.\-\+]*)://'          # Scheme (enforced separately)
         r'^(?:[a-z0-9\.\-\+]*)://'          # Scheme (enforced separately)
         r'(?:\S+(?::\S*)?@)?'               # HTTP basic authentication
         r'(?:\S+(?::\S*)?@)?'               # HTTP basic authentication
         r'(?:' + '|'.join(host_res) + ')'   # IPv4, IPv6, FQDN, or hostname
         r'(?:' + '|'.join(host_res) + ')'   # IPv4, IPv6, FQDN, or hostname
-        r'(?::\d{2,5})?'                    # Port number
+        r'(?::\d{1,5})?'                    # Port number
         r'(?:[/?#][^\s]*)?'                 # Path
         r'(?:[/?#][^\s]*)?'                 # Path
         r'\Z', re.IGNORECASE)
         r'\Z', re.IGNORECASE)
     schemes = None
     schemes = None