File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,20 @@ def is_running_locally():
374
374
# The rest are the api routes and the main page route
375
375
#
376
376
377
+ @app .before_request
378
+ def check_for_escaped_hash ():
379
+ """
380
+ special case to check for escaped hash at beginning of path. Joe Heafner reported a problem where an URL with a '%23'
381
+ immidiately after the first '/' would produce a 404. Unfortunatey this happens before our routes are matched, so we
382
+ need to handle it in 'before_request'. Here we just check for this situation and redirect using a regular hash/fragment.
383
+ """
384
+ url = flask .request .url
385
+ p = urllib .parse .urlparse (url )
386
+ if p .path .startswith ('/%23' ):
387
+ newPath = '/#' + p .path [4 :]
388
+ newURL = urllib .parse .urlunparse (p [0 :2 ]+ ('/#' + p .path [4 :],)+ p [3 :])
389
+ return flask .redirect (newURL )
390
+
377
391
@app .route ('/api/login' )
378
392
def api_login ():
379
393
if auth .is_logged_in ():
You can’t perform that action at this time.
0 commit comments