Skip to content

readd UploadFile.filename for compat with StarletteUploadFile#5772

Merged
adhami3310 merged 1 commit intomainfrom
khaleel/eng-7606-define-uploadfilefilename
Sep 9, 2025
Merged

readd UploadFile.filename for compat with StarletteUploadFile#5772
adhami3310 merged 1 commit intomainfrom
khaleel/eng-7606-define-uploadfilefilename

Conversation

@adhami3310
Copy link
Member

No description provided.

@linear
Copy link

linear bot commented Sep 9, 2025

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR adds a filename property to the UploadFile class in reflex/app.py to restore compatibility with StarletteUploadFile. The UploadFile class inherits from StarletteUploadFile, which typically provides a filename attribute for accessing the original filename of uploaded files. However, Reflex's implementation was missing this property, potentially breaking code that expected the standard filename interface.

The implementation is straightforward - the new filename property simply delegates to the existing name property, which already handles the logic of extracting the filename from the file path. This approach maintains backward compatibility while preserving the existing functionality. The change fits well within the codebase's pattern of extending external classes while maintaining their expected interfaces.

The name property (lines 270-279) already contains the core logic for extracting the filename from self.path.name when a path exists, or returning None otherwise. The new filename property (lines 261-268) acts as an alias, providing the same functionality through the interface that StarletteUploadFile users would expect.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk
  • Score reflects simple delegation pattern with no complex logic changes
  • No files require special attention

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 9, 2025

CodSpeed Performance Report

Merging #5772 will not alter performance

Comparing khaleel/eng-7606-define-uploadfilefilename (e100457) with main (51f9f2c)

Summary

✅ 8 untouched benchmarks

@adhami3310 adhami3310 merged commit 2e0e20f into main Sep 9, 2025
41 checks passed
@adhami3310 adhami3310 deleted the khaleel/eng-7606-define-uploadfilefilename branch September 9, 2025 18:03
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.

2 participants