readd UploadFile.filename for compat with StarletteUploadFile#5772
readd UploadFile.filename for compat with StarletteUploadFile#5772adhami3310 merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
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
CodSpeed Performance ReportMerging #5772 will not alter performanceComparing Summary
|
No description provided.