mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +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:
@ -40,12 +40,10 @@ class Attachment extends Model
|
||||
|
||||
/**
|
||||
* Get the downloadable file name for this upload.
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getFileName()
|
||||
public function getFileName(): string
|
||||
{
|
||||
if (strpos($this->name, '.') !== false) {
|
||||
if (str_contains($this->name, '.')) {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
@ -71,7 +69,7 @@ class Attachment extends Model
|
||||
*/
|
||||
public function getUrl($openInline = false): string
|
||||
{
|
||||
if ($this->external && strpos($this->path, 'http') !== 0) {
|
||||
if ($this->external && !str_starts_with($this->path, 'http')) {
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user