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


##########
airflow-core/src/airflow/models/errors.py:
##########
@@ -33,13 +34,20 @@ class ParseImportError(Base):
     __tablename__ = "import_error"
     id: Mapped[int] = mapped_column(Integer, primary_key=True)
     timestamp: Mapped[datetime | None] = mapped_column(UtcDateTime, 
nullable=True)
-    filename: Mapped[str | None] = mapped_column(String(1024), nullable=True)
+    source_reference: Mapped[str | None] = mapped_column(String(1024), 
nullable=True)
     bundle_name: Mapped[str | None] = mapped_column(StringID(), nullable=True)
     stacktrace: Mapped[str | None] = mapped_column(Text, nullable=True)
 
+    filename = synonym("source_reference")
+
     def full_file_path(self) -> str:
         """Return the full file path of the dag."""
-        if self.bundle_name is None or self.filename is None:
-            raise ValueError("bundle_name and filename must not be None")
+        if self.bundle_name is None or self.source_reference is None:
+            raise ValueError("bundle_name and source_reference must not be 
None")
         bundle = DagBundlesManager().get_bundle(self.bundle_name)
-        return "/".join([str(bundle.path), self.filename])
+        ref = self.source_reference
+        # A reference may address a member inside a container 
(``archive.zip:dags/my_dag.py``); the
+        # anchor alone decides whether it is already rooted, so the separator 
is never parsed here.
+        if ref.startswith(str(bundle.path)) or Path(ref).is_absolute():
+            return ref

Review Comment:
   The `startswith` would false-positive across sibling bundles that share a 
path prefix (`/data/dags` vs `/data/dags-x`).



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