Download this file
| 1 | package mapa |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | // Fable L7 on 49d8df3: Remove's way back is safeReturn's rule, which |
| 6 | // refuses a control character: "/\t/evil.example" is a link off-site in |
| 7 | // a browser that drops the tab. |
| 8 | func TestRemovesWayBackStaysInMapa(t *testing.T) { |
| 9 | for raw, want := range map[string]string{ |
| 10 | "/p/abc/edit": "/p/abc/edit", |
| 11 | "/\t/evil.example": "/", |
| 12 | "//evil.example": "/", |
| 13 | "/\\evil.example": "/", |
| 14 | "https://evil.example": "/", |
| 15 | "": "/", |
| 16 | } { |
| 17 | if got := backTo(raw); got != want { |
| 18 | t.Errorf("backTo(%q) = %q, want %q", raw, got, want) |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |