diff --git a/ingestion_tools/scripts/common/config.py b/ingestion_tools/scripts/common/config.py index f5d6b7d7c..d9e2b7773 100644 --- a/ingestion_tools/scripts/common/config.py +++ b/ingestion_tools/scripts/common/config.py @@ -251,4 +251,8 @@ def to_formatted_path(self, path: str) -> str: """ Returns the s3 key, without the bucket name, for the given path. Helpful for formatting paths in metadata. """ - return os.path.relpath(path, self.output_prefix) if path else None + if path: + if path.startswith(self.output_prefix): + return os.path.relpath(path, self.output_prefix) + return path + return None