alexkruc commented on code in PR #25280:
URL: https://github.com/apache/airflow/pull/25280#discussion_r938684665
##########
airflow/models/dag.py:
##########
@@ -2781,6 +2801,20 @@ def validate_schedule_and_params(self):
"DAG Schedule must be None, if there are any required
params without default values"
)
+ def validate_owner_links(self) -> Dict[str, str]:
+ """Parses a given link, and verifies if it's a valid URL, or a
'mailto' link"""
+ wrong_links = {}
+ for owner, link in self.owner_links.items():
+ result = urlparse(link)
+ if link.startswith('mailto:'):
+ # netloc is not existing for 'mailto' link, so we are checking
that the path is parsed
+ if not all([result.scheme, result.path]):
+ wrong_links.update({owner: link})
+ elif not all([result.scheme, result.netloc]):
+ wrong_links.update({owner: link})
+
+ return wrong_links
Review Comment:
Thanks for the tip! I changed the code to use an iterator :)
I didn't commit your suggestion as I changed it a bit (just minor changes),
but the flow is as you suggested, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]