From 7f0116497d7aa2cf644fc6596b4af418cc6249ec Mon Sep 17 00:00:00 2001 From: Adam Rimon Date: Thu, 2 Jun 2022 15:29:45 +0300 Subject: [PATCH] fixed url validation regex --- fhir/resources/STU3/fhirtypes.py | 2 +- fhir/resources/fhirtypes.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fhir/resources/STU3/fhirtypes.py b/fhir/resources/STU3/fhirtypes.py index 28ee9d3e..0dda8d3d 100644 --- a/fhir/resources/STU3/fhirtypes.py +++ b/fhir/resources/STU3/fhirtypes.py @@ -371,7 +371,7 @@ class Url(AnyUrl, Primitive): Common URL protocols are http{s}:, ftp:, mailto: and mllp:, though many others are defined""" - path_regex = re.compile(r"^/(?P[^\s?/]+)(/[^\s?/]+)*") + path_regex = re.compile(r"^\/?(?P[^\s?\/]+)(\/[^\s?\/]+)*") __visit_name__ = "url" @classmethod diff --git a/fhir/resources/fhirtypes.py b/fhir/resources/fhirtypes.py index 61c9ef6f..125f2cd7 100644 --- a/fhir/resources/fhirtypes.py +++ b/fhir/resources/fhirtypes.py @@ -371,7 +371,7 @@ class Url(AnyUrl, Primitive): Common URL protocols are http{s}:, ftp:, mailto: and mllp:, though many others are defined""" - path_regex = re.compile(r"^/(?P[^\s?/]+)(/[^\s?/]+)*") + path_regex = re.compile(r"^\/?(?P[^\s?\/]+)(\/[^\s?\/]+)*") __visit_name__ = "url" @classmethod