whereto: support [codes] in .htaccess

Bug #1853891 reported by Eric Fried
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstackdocstheme
New
Undecided
Unassigned

Bug Description

(Erroneously opened this as https://storyboard.openstack.org/#!/story/2006943 before noticing we're back to LP.)

Discovered via [1], which tried to do a redirectmatch to a target with an #anchor in it.

That wouldn't work (though we can't prove it in CI because the CI docs build doesn't appear to process .htaccess -- which I suppose makes sense as that would entail restarting the build server's httpd? not sure) unless you added the [NE] flag [2]. But (aside from not being able to tell if it worked until published) whereto hates that:

 docs run-test: commands[4] | whereto doc/build/html/.htaccess doc/test/redirect-tests.txt
 Traceback (most recent call last):
  File "/home/efried/openstack/nova/.tox/docs/bin/whereto", line 8, in <module>
    sys.exit(main())
  File "/home/efried/openstack/nova/.tox/docs/lib/python3.6/site-packages/whereto/app.py", line 195, in main
    ruleset.add(linenum, *params)
  File "/home/efried/openstack/nova/.tox/docs/lib/python3.6/site-packages/whereto/rules.py", line 113, in add
    rule = self._factories[rule_type](linenum, *params)
  File "/home/efried/openstack/nova/.tox/docs/lib/python3.6/site-packages/whereto/rules.py", line 77, in __init__
    super(RedirectMatch, self).__init__(linenum, *params)
  File "/home/efried/openstack/nova/.tox/docs/lib/python3.6/site-packages/whereto/rules.py", line 50, in __init__
    raise ValueError('Could not understand rule {}'.format(params))
 ValueError: Could not understand rule ('redirectmatch', '301', '^/nova/([^/]+)/admin/manage-users.html$', '/nova/$1/admin/arch.html#projects-users-and-roles', '[NE]')
 ERROR: InvocationError for command /home/efried/openstack/nova/.tox/docs/bin/whereto doc/build/html/.htaccess doc/test/redirect-tests.txt (exited with code 1)

So this RFE is to beef up whereto to understand these codes. (To be fair, I'm not sure if it should really understand them -- e.g., know that a redirect to /foo.html#bar is /foo.html%23bar without [NE] and /foo.html#bar with it -- or if it should just retain its existing logic but not blow up when there's a fifth field on the .htaccess line. Baby steps?)

[1] https://review.opendev.org/#/c/695779/1/doc/source/_extra/.htaccess@80
[2] http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne

Tags: rfe
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.