Fix src file lookup when subfolder is provided in asset()#6062
Fix src file lookup when subfolder is provided in asset()#6062martiniifun wants to merge 1 commit intoreflex-dev:mainfrom
Conversation
Greptile SummaryThis PR fixes a bug in the Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User Code
participant Asset as asset() function
participant FS as File System
participant Symlink as App Assets Dir
User->>Asset: rx.asset(path="logo.jpg", shared=True, subfolder="images")
Asset->>FS: Check source file at calling_file.parent/images/logo.jpg
FS-->>Asset: File exists
Asset->>Symlink: Create symlink at app/external/module/images/logo.jpg
Symlink-->>Asset: Symlink created
Asset-->>User: Return "/external/module/images/logo.jpg"
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
masenf
left a comment
There was a problem hiding this comment.
the subfolder arg is really intended as a target for where to copy the asset to in the final path.
the correct fix here would be to pass the the relative path for path argument, and then take just the filename part of the path when constructing the dst_file and return value.
When using
rx.asset(path="logo.jpg", shared=True, subfolder="images"), the current implementation looks for.../logo.jpginstead of.../images/logo.jpg. This PR updates the logic to include thesubfolderin the source file path check.