Commit d6c253b
committed
fix(ui,test): same-origin port check + robust body read
Two follow-up nits from the Copilot review on PR #579:
- bulkRedirectAfter's same-origin guard compared refURL.Host
(hostname:port) against c.Hostname() (hostname only). A same-origin
Referer whose URL included the port — common in dev (localhost:3000)
and behind some reverse proxies — was incorrectly flagged as cross-
origin, falling back to the bare list path and losing filters. Fixed
to refURL.Hostname() vs c.Hostname(). New subtest
"same-origin with explicit port preserved" locks in the behaviour.
- bulk_redirect_test.go read the response body with a single
Read into a fixed 256-byte buffer. Read is allowed to return partial
data; if the helper output ever grew past 256 bytes or the reader
fragmented the response, the assertion would silently truncate and
either pass on a partial match or false-positive on a trailing
diff. Replaced with io.ReadAll.
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>1 parent 4d1a230 commit d6c253b
2 files changed
Lines changed: 26 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
73 | 88 | | |
74 | 89 | | |
75 | 90 | | |
| |||
111 | 126 | | |
112 | 127 | | |
113 | 128 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
119 | 134 | | |
120 | 135 | | |
121 | 136 | | |
| |||
0 commit comments