forked from cadence/breezewiki
Stop redirecting pages if there's a redirect=no parameter
Fixes /agk/wiki/Cansin13?redirect=no (from /agk/wiki/User:Cansin13)
This commit is contained in:
parent
a661ddb313
commit
278b1a8820
1 changed files with 4 additions and 1 deletions
|
@ -317,10 +317,13 @@
|
||||||
#:head-data head-data
|
#:head-data head-data
|
||||||
#:siteinfo siteinfo))
|
#:siteinfo siteinfo))
|
||||||
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
|
(define redirect-msg ((query-selector (attribute-selector 'class "redirectMsg") body)))
|
||||||
|
(define redirect-query-parameter (dict-ref (url-query (request-uri req)) 'redirect "yes"))
|
||||||
(define headers
|
(define headers
|
||||||
(build-headers
|
(build-headers
|
||||||
always-headers
|
always-headers
|
||||||
(when redirect-msg
|
; no need to check for any other possible string value since only "no" is interpreted
|
||||||
|
; https://github.com/Wikia/app/blob/fe60579a53f16816d65dad1644363160a63206a6/includes/Wiki.php#L367
|
||||||
|
(when (and redirect-msg (not (eq? redirect-query-parameter "no")))
|
||||||
(let* ([dest (get-attribute 'href (bits->attributes ((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))))]
|
(let* ([dest (get-attribute 'href (bits->attributes ((query-selector (λ (t a c) (eq? t 'a)) redirect-msg))))]
|
||||||
[value (bytes-append #"0;url=" (string->bytes/utf-8 dest))])
|
[value (bytes-append #"0;url=" (string->bytes/utf-8 dest))])
|
||||||
(header #"Refresh" value)))))
|
(header #"Refresh" value)))))
|
||||||
|
|
Loading…
Reference in a new issue