Monorepo for Tangled tangled.org

fix(appview/middleware): capture return URLs when coming from external #1064

open opened by brookjeynes.dev targeting master

.

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:4mj54vc4ha3lh32ksxwunnbh/sh.tangled.repo.pull/3meklb3hmcp22
+7 -1
Diff #0
+7 -1
appview/middleware/middleware.go
··· 48 48 return func(next http.Handler) http.Handler { 49 49 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 50 50 returnURL := "/" 51 + if r.URL != nil { 52 + returnURL = r.URL.String() 53 + } 51 54 if u, err := url.Parse(r.Header.Get("Referer")); err == nil { 52 - returnURL = u.RequestURI() 55 + if u.RequestURI() != "/" { 56 + fmt.Printf("referrer: %s\n", u.RequestURI()) 57 + returnURL = u.RequestURI() 58 + } 53 59 } 54 60 55 61 loginURL := fmt.Sprintf("/login?return_url=%s", url.QueryEscape(returnURL))

History

1 round 0 comments
sign up or login to add to the discussion
brookjeynes.dev submitted #0
no conflicts, ready to merge
expand 0 comments