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:
@@ -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();
|
||||
|
Reference in New Issue
Block a user