Skip to content

Conversation

@kiran2706
Copy link
Contributor

@kiran2706 kiran2706 commented Jun 12, 2025

The upload() method allows empty strings ("") as valid values for filename and data
to support scenarios where uploading an intentionally empty file or data stream is required.

✔️ Examples of valid use cases:

  • Uploading an empty file to mark the completion of a batch process (e.g., _SUCCESS marker).
  • Writing an empty blob as a coordination or trigger signal.
  • Supporting systems that expect the presence of a file, even if it has zero content.

❗ Important distinctions:

  • filename=None and data=None → invalid (nothing to upload)
  • filename != None and data != None → invalid (ambiguous source)
  • filename="" → valid, treated as explicit instruction to upload from an empty file path
  • data="" → valid, uploads an empty blob

To avoid accidental misuse, upstream callers should ensure that empty values are intentional.

ttencate and others added 2 commits June 3, 2025 10:31
Passing data="" did not work because it evaluates to False.

Made the same change for filename as well, so that filename="" will now give a clearer error when trying to open the file.
@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Jun 12, 2025
@kiran2706 kiran2706 changed the title Pr/ttencate/51346 Allow creation of empty files on GCS Jun 12, 2025
@kiran2706
Copy link
Contributor Author

@potiuk, Please review the changes. Thanks in advance.

@potiuk potiuk merged commit 2f0248c into apache:main Jun 13, 2025
70 checks passed
choo121600 pushed a commit to choo121600/airflow that referenced this pull request Jun 14, 2025
* Allow creation of empty files on GCS

Passing data="" did not work because it evaluates to False.

Made the same change for filename as well, so that filename="" will now give a clearer error when trying to open the file.

* added test cases

---------

Co-authored-by: Thomas ten Cate <ttencate@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants