davidnzhang commented on code in PR #69014:
URL: https://github.com/apache/airflow/pull/69014#discussion_r3485702009


##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/msgraph.py:
##########
@@ -311,7 +311,7 @@ def _build_request_adapter(self, connection) -> tuple[str, 
RequestAdapter]:
             scopes = scopes.split(",")
         verify = config.get("verify", True)
         trust_env = config.get("trust_env", False)
-        allowed_hosts = (config.get("allowed_hosts", authority) or 
"").split(",")
+        allowed_hosts = [host for host in (config.get("allowed_hosts", 
authority) or "").split(",") if host]

Review Comment:
   Thanks for your suggestions @SameerMesiah97 @dabla 
   
   I've just split this out into its own static method in 63f1456 as it seems 
like it's doing a few different things now.
   
   Also added the filtering logic for empty host entries in 5e90794.
   
   I think blank entries in an otherwise valid list e.g. "host1,,host2," and 
"," as suggested by @SameerMesiah97 in the testing thread was not the target of 
this fix, which is to allow the early return for truly empty allowed_hosts in 
`AllowedHostsValidator`.  The first example "host1,,host2," would still allow 
for validation to occur on host1 and host2. The second example "," will 
actually fail validation without `[host for host in ... if host]` but is 
arguably a garbage in garbage out situation.



-- 
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]

Reply via email to