1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Increased attachment link limit from 192 to 2k

Added test to cover.
Did attempt a 64k limit, but values over 2k significantly increase
chance of other issues since this URL may be used in redirect headers.
Would rather catch issues in-app.

For #4044
This commit is contained in:
Dan Brown
2023-02-20 13:05:23 +00:00
parent 8da3e64039
commit c80396136f
6 changed files with 71 additions and 26 deletions

View File

@@ -111,6 +111,29 @@ class AttachmentTest extends TestCase
$this->files->deleteAllAttachmentFiles();
}
public function test_attaching_long_links_to_a_page()
{
$page = $this->entities->page();
$link = 'https://example.com?query=' . str_repeat('catsIScool', 195);
$linkReq = $this->asAdmin()->post('attachments/link', [
'attachment_link_url' => $link,
'attachment_link_name' => 'Example Attachment Link',
'attachment_link_uploaded_to' => $page->id,
]);
$linkReq->assertStatus(200);
$this->assertDatabaseHas('attachments', [
'uploaded_to' => $page->id,
'path' => $link,
'external' => true,
]);
$attachment = $page->attachments()->where('external', '=', true)->first();
$resp = $this->get($attachment->getUrl());
$resp->assertRedirect($link);
}
public function test_attachment_updating()
{
$page = $this->entities->page();