From e5ce954584e024e6dd028994fc0f4dd1ecbc7275 Mon Sep 17 00:00:00 2001 From: Evgeniy Sazonov Date: Thu, 30 Oct 2025 16:05:51 +0700 Subject: [PATCH] fix(compose): resolve infinite recursion in ComposeSource properties The `object_size` and `headers` properties in `ComposeSource` were incorrectly referencing themselves, causing a RecursionError when accessed before `build_headers()` was called. Updated both properties to correctly reference the internal `_object_size` and `_headers` fields and return their values with proper initialization checks. --- minio/commonconfig.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/minio/commonconfig.py b/minio/commonconfig.py index 993e6967..33b3381d 100644 --- a/minio/commonconfig.py +++ b/minio/commonconfig.py @@ -466,22 +466,22 @@ def build_headers(self, object_size: int, etag: str): @property def object_size(self) -> Optional[int]: """Get object size.""" - if self.object_size is None: + if self._object_size is None: raise MinioException( "build_headers() must be called prior to " "this method invocation", ) - return self.object_size + return self._object_size @property def headers(self) -> dict[str, str]: """Get headers.""" - if self.headers is None: + if self._headers is None: raise MinioException( "build_headers() must be called prior to " "this method invocation", ) - return self.headers.copy() + return self._headers.copy() @classmethod def of(cls: Type[F], src: ObjectConditionalReadArgs) -> F: