You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2025/11/05 09:29:53 UTC

Re: [PR] Fix Asset URI normalization for user info without password (#51877) [airflow]

uranusjr commented on code in PR #57650:
URL: https://github.com/apache/airflow/pull/57650#discussion_r2493669159


##########
task-sdk/src/airflow/sdk/definitions/asset/__init__.py:
##########
@@ -166,15 +166,16 @@ def _sanitize_uri(inp: str | ObjectStoragePath) -> str:
         return uri
     if normalized_scheme == "airflow":
         raise ValueError("Asset scheme 'airflow' is reserved")
-    _, auth_exists, normalized_netloc = parsed.netloc.rpartition("@")
-    if auth_exists:
+    if parsed.password:
         # TODO: Collect this into a DagWarning.
         warnings.warn(
-            "An Asset URI should not contain auth info (e.g. username or "
-            "password). It has been automatically dropped.",
+            "An Asset URI should not contain a password. User info has been automatically dropped.",
             UserWarning,
             stacklevel=3,
         )
+        normalized_netloc = parsed.netloc.split("@", 1)[1]

Review Comment:
   ```suggestion
           _, _, normalized_netloc = parsed.netloc.rpartition("@")
   ```
   
   According to the spec, `@` must be split from the right, not left.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org