Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: filters/stripindex.py

Issue 29332874: Issue 3435 - strip "index" from page path for canonical URL (Closed)
Left Patch Set: Created Dec. 18, 2015, 10:28 a.m.
Right Patch Set: Went with Wladimir suggestion Created Dec. 18, 2015, 11:08 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | templates/default.tmpl » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 def stripindex(path): 1 def stripindex(path):
2 if path.endswith("index"): 2 parts = path.split("/")
3 return path[:-5] 3 if parts[-1] == "index":
Wladimir Palant 2015/12/18 10:58:15 This logic is wrong - imagine a page called fooind
saroyanm 2015/12/18 11:10:15 Ahh right.
Wladimir Palant 2015/12/18 11:13:44 In fact, given that this logic is only necessary i
saroyanm 2015/12/18 11:24:18 IMO it will affect readability of template file, I
Wladimir Palant 2015/12/18 11:58:31 Fair enough.
4 return path 4 parts.pop()
5 5 return "/".join(parts)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld