-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace locate_template method #28942
Conversation
Size Change: 0 B Total Size: 1.37 MB ℹ️ View Unchanged
|
Just curious, is there a reason we don't use |
I think the API in this PR is simpler to operate with: it either returns an empty string or a full path to a readable file, hence consumers don't need to check anything else than whether the result is an empty string (quick check). With |
Gotcha. Thanks for the explanation @nosolosw 👍 |
4c71a1d
to
3f6d0cf
Compare
Some other things landed, so had to rebase. Welcome a 👍 ! |
3f6d0cf
to
8e580e0
Compare
I've rebased this from master, there were some conflicts and also unrelated mobile test failures. Anyone can give this a 👍 if it looks good? |
8e580e0
to
7066f08
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Tested and confirmed
Fixes #26359
Related #28410 (comment)
This PR replaces
locate_method
by building the file path ourselves by means ofget_stylesheet_directory
. It also minimizes the number of times we check the file exists and is readable.This stems from this conversation and a bug report (while I couldn't reproduce, I understand that validates the idea that
locate_template
is unsafe in certain scenarios).Test