Skip to content

Commit f6acd8d

Browse files
fix(web): recognize quoted request targets in terminal logs
1 parent f791fbf commit f6acd8d

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎apps/web/src/terminal-links.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ describe("extractTerminalLinks", () => {
175175
it.each([
176176
" GET /api/trpc/post.list,user.me?batch=1&input=%7B%220%22%3A%7B%22json%22%3Anull%7D%7D 200 in 35ms",
177177
"GET /api?+debug 200",
178+
'Started GET "/posts?page=2" for ::1',
178179
"proxying api/trpc/post.list?batch=1 to the backend",
179180
])("does not turn a logged request route into an editor link: %s", (line) => {
180181
expect(extractTerminalLinks(line)).toEqual([]);

‎apps/web/src/terminal-links.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const TRAILING_PUNCTUATION_PATTERN = /[.,;!?]+$/;
3636
const TRAILING_PATH_PUNCTUATION_PATTERN = /[.,;:!?]+$/;
3737
// A question mark is legal in filenames; only exclude query-bearing request targets.
3838
const REQUEST_ROUTE_PATTERN =
39-
/(?:^|[\s"'`])(?:GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS|CONNECT|TRACE|proxying)\s+(?:\/|[A-Za-z0-9_-]+\/)[^\s?]*\?\S*/g;
39+
/(?:^|[\s"'`])(?:GET|HEAD|POST|PUT|PATCH|DELETE|OPTIONS|CONNECT|TRACE|proxying)\s+["'`]?(?:\/|[A-Za-z0-9_-]+\/)[^\s?]*\?\S*/g;
4040

4141
function trimClosingDelimiters(value: string, kind: TerminalLinkKind): string {
4242
let output = value.replace(

0 commit comments

Comments
 (0)