-
Notifications
You must be signed in to change notification settings - Fork 37
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
fix: loop over forward slashes for relative dir, replace after urlencode #64
base: v5.5.x
Are you sure you want to change the base?
Conversation
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.
This looks nice, I will check the code base to see if this is the right solution or if other places could be broken
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v5.5.x #64 +/- ##
=========================================
Coverage 63.99% 63.99%
Complexity 1252 1252
=========================================
Files 53 53
Lines 3611 3611
=========================================
Hits 2311 2311
Misses 1300 1300 ☔ View full report in Codecov by Sentry. |
Update: I am a bit unsatisfied about the current code, maybe I will refactor it a bit before merging this |
@@ -69,7 +69,7 @@ | |||
<select class="form-control" id="version-switcher" name="version"> | |||
{% for version in project.versions %} | |||
<option | |||
value="{{ path('../' ~ version|url_encode ~ '/index.html') }}" | |||
value="{% for i in project.version|split('/') %}../{% endfor %}{{ path(version|url_encode|replace({ '%2F': '/' }) ~ '/index.html') }}" |
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.
I'd recommend making a new template function in PHP-land.
That means:
- You can unit test the function
- Templates are easier to read - these templates are already pretty complicated
- If this same thing needs to happen elsewhere, the same function can be reused
- It's easier to make readable functional code in PHP than templates (imo)
Fixes #63