Skip to content

Conversation

@mpivchev
Copy link
Collaborator

@mpivchev mpivchev commented Nov 27, 2025

An empty .md or .txt is 0 bytes, and the check if the file exists in the document storage expects the size of the file to be > 0. This removes the check, which allows a 0 byte file to be shared.

@marinofaggiana do you think this is a dangerous solution? I haven't noticed any issues so far. I think all the other checks we do to make sure the file exists are enough.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where empty files (0 bytes) could not be shared because the fileProviderStorageExists method incorrectly rejected files with zero size. The fix removes the && metadata.size > 0 condition from the file existence checks.

Key Changes:

  • Removed the metadata.size > 0 check from two return statements in the fileProviderStorageExists method
  • Now allows empty files (0 bytes) to be recognized as valid for sharing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <[email protected]>
Signed-off-by: Milen Pivchev <[email protected]>
@marinofaggiana
Copy link
Member

#if EXTENSION_FILE_PROVIDER_EXTENSION
return (fileNameViewSize == metadata.size) && metadata.size > 0
#else

Must exists because in FILE_PROVIDER_EXTENSION I'm not sure of the effects

Copy link
Member

@marinofaggiana marinofaggiana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXTENSION_FILE_PROVIDER_EXTENSION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants