From d3a5b080dc8803d8691be0e3ca02b62302d75f21 Mon Sep 17 00:00:00 2001
From: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Date: Tue, 3 Nov 2026 03:51:16 +0530
Subject: [PATCH 1/3] feat: use QUERY for oversized link lookups
---
resources/js/pages/links/index.tsx | 29 +++++++++++++++----
routes/web.php | 2 +-
.../Controllers/LinkControllerTest.php | 14 +++++++++
3 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/resources/js/pages/links/index.tsx b/resources/js/pages/links/index.tsx
index 2733a56ad6..9159f3c4ad 100644
--- a/resources/js/pages/links/index.tsx
+++ b/resources/js/pages/links/index.tsx
@@ -42,13 +42,34 @@ function peopleCount(count: number) {
return count === 1 ? '1 person' : `${count} people`;
}
+function linkVisit(url: string) {
+ const destination = LinkController.index({
+ query: url === '' ? {} : { url },
+ }).url;
+
+ if (destination.length > 1_800) {
+ return {
+ href: LinkController.index().url,
+ method: 'query' as const,
+ data: { url },
+ };
+ }
+
+ return { href: destination, method: 'get' as const, data: {} };
+}
+
export default function Index(props: Props) {
const [draft, setDraft] = useState(props.url ?? '');
const submit = (event: FormEvent) => {
event.preventDefault();
- const url = draft.trim();
- router.get(LinkController.index({ query: url === '' ? {} : { url } }));
+ const visit = linkVisit(draft.trim());
+
+ if (visit.method === 'query') {
+ router.query(visit.href, visit.data);
+ } else {
+ router.get(visit.href);
+ }
};
return (
@@ -110,9 +131,7 @@ function TopLinks({ links }: { links: TopLink[] }) {
diff --git a/routes/web.php b/routes/web.php
index 15732268d8..456aa4ca3d 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -395,7 +395,7 @@
Route::get('starred', [StarredCommitController::class, 'index'])->name('starred.index');
// Every commit about a link, a prototype only reachable by its URL...
- Route::get('links', [LinkController::class, 'index'])->name('link.index');
+ Route::match(['GET', 'QUERY'], 'links', [LinkController::class, 'index'])->name('link.index');
// Commit...
Route::get('scheduled-commits', [ScheduledCommitController::class, 'index'])->name('scheduled-commit.index');
diff --git a/tests/Feature/Controllers/LinkControllerTest.php b/tests/Feature/Controllers/LinkControllerTest.php
index 7539d01aeb..ae4dabba72 100644
--- a/tests/Feature/Controllers/LinkControllerTest.php
+++ b/tests/Feature/Controllers/LinkControllerTest.php
@@ -92,3 +92,17 @@
->where('stats', ['commits' => 0, 'people' => 0])
->where('commits', null));
});
+
+it('accepts a long link lookup in a QUERY request body', function (): void {
+ $url = 'https://example.com/'.str_repeat('a', 1900);
+ $link = LinkPreview::factory()->fetched()->create(['url' => $url]);
+ $first = Commit::factory()->create(['link_preview_id' => $link->id]);
+
+ $this->actingAs(User::factory()->create())
+ ->json('QUERY', route('link.index'), ['url' => $url])
+ ->assertOk()
+ ->assertInertia(fn ($page) => $page
+ ->component('links/index')
+ ->where('url', $url)
+ ->where('commits.data.0.id', $first->id));
+});
From 96e0cf0a518d63101d272f6222de3b85ae69a041 Mon Sep 17 00:00:00 2001
From: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Date: Tue, 3 Nov 2026 14:10:07 +0530
Subject: [PATCH 2/3] fix: reset links page state for oversized query
navigation
---
resources/js/pages/links/index.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/resources/js/pages/links/index.tsx b/resources/js/pages/links/index.tsx
index 9159f3c4ad..c211c96fc1 100644
--- a/resources/js/pages/links/index.tsx
+++ b/resources/js/pages/links/index.tsx
@@ -52,6 +52,7 @@ function linkVisit(url: string) {
href: LinkController.index().url,
method: 'query' as const,
data: { url },
+ preserveState: false,
};
}
@@ -66,7 +67,7 @@ export default function Index(props: Props) {
const visit = linkVisit(draft.trim());
if (visit.method === 'query') {
- router.query(visit.href, visit.data);
+ router.query(visit.href, visit.data, { preserveState: false });
} else {
router.get(visit.href);
}
From 209ca1ba9836acb4afedd846236db77cae00394b Mon Sep 17 00:00:00 2001
From: Punyapal Shah
Date: Tue, 3 Nov 2026 17:40:04 +0530
Subject: [PATCH 3/3] fix: use POST for oversized link lookups
---
resources/js/pages/links/index.tsx | 6 +++---
routes/web.php | 2 +-
tests/Feature/Controllers/LinkControllerTest.php | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/resources/js/pages/links/index.tsx b/resources/js/pages/links/index.tsx
index c211c96fc1..958ab11b5b 100644
--- a/resources/js/pages/links/index.tsx
+++ b/resources/js/pages/links/index.tsx
@@ -50,7 +50,7 @@ function linkVisit(url: string) {
if (destination.length > 1_800) {
return {
href: LinkController.index().url,
- method: 'query' as const,
+ method: 'post' as const,
data: { url },
preserveState: false,
};
@@ -66,8 +66,8 @@ export default function Index(props: Props) {
event.preventDefault();
const visit = linkVisit(draft.trim());
- if (visit.method === 'query') {
- router.query(visit.href, visit.data, { preserveState: false });
+ if (visit.method === 'post') {
+ router.post(visit.href, visit.data, { preserveState: false });
} else {
router.get(visit.href);
}
diff --git a/routes/web.php b/routes/web.php
index 456aa4ca3d..659e2f0b4c 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -395,7 +395,7 @@
Route::get('starred', [StarredCommitController::class, 'index'])->name('starred.index');
// Every commit about a link, a prototype only reachable by its URL...
- Route::match(['GET', 'QUERY'], 'links', [LinkController::class, 'index'])->name('link.index');
+ Route::match(['GET', 'POST'], 'links', [LinkController::class, 'index'])->name('link.index');
// Commit...
Route::get('scheduled-commits', [ScheduledCommitController::class, 'index'])->name('scheduled-commit.index');
diff --git a/tests/Feature/Controllers/LinkControllerTest.php b/tests/Feature/Controllers/LinkControllerTest.php
index ae4dabba72..c37cfa831d 100644
--- a/tests/Feature/Controllers/LinkControllerTest.php
+++ b/tests/Feature/Controllers/LinkControllerTest.php
@@ -93,13 +93,13 @@
->where('commits', null));
});
-it('accepts a long link lookup in a QUERY request body', function (): void {
+it('accepts a long link lookup in a POST request body', function (): void {
$url = 'https://example.com/'.str_repeat('a', 1900);
$link = LinkPreview::factory()->fetched()->create(['url' => $url]);
$first = Commit::factory()->create(['link_preview_id' => $link->id]);
$this->actingAs(User::factory()->create())
- ->json('QUERY', route('link.index'), ['url' => $url])
+ ->post(route('link.index'), ['url' => $url])
->assertOk()
->assertInertia(fn ($page) => $page
->component('links/index')