From 210f895e7410096dad56e66ab853714f34c9fbf5 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Wed, 18 Aug 2021 22:11:07 +0100 Subject: [PATCH] [ENTITY][Attachment] Respect rfc6838#section-4.2 mimetype length --- src/Entity/Attachment.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Entity/Attachment.php b/src/Entity/Attachment.php index 9b8ac11134..b1bdb0e476 100644 --- a/src/Entity/Attachment.php +++ b/src/Entity/Attachment.php @@ -111,18 +111,6 @@ class Attachment extends Entity return $this->mimetype; } - public function getMimetypeMajor(): ?string - { - $mime = $this->getMimetype(); - return is_null($mime) ? $mime : GSFile::mimetypeMajor($mime); - } - - public function getMimetypeMinor(): ?string - { - $mime = $this->getMimetype(); - return is_null($mime) ? $mime : GSFile::mimetypeMinor($mime); - } - public function setFilename(?string $filename): self { $this->filename = $filename; @@ -181,6 +169,18 @@ class Attachment extends Entity // @codeCoverageIgnoreEnd // }}} Autocode + public function getMimetypeMajor(): ?string + { + $mime = $this->getMimetype(); + return is_null($mime) ? $mime : GSFile::mimetypeMajor($mime); + } + + public function getMimetypeMinor(): ?string + { + $mime = $this->getMimetype(); + return is_null($mime) ? $mime : GSFile::mimetypeMinor($mime); + } + /** * @return int */ @@ -344,7 +344,7 @@ class Attachment extends Entity 'id' => ['type' => 'serial', 'not null' => true], 'lives' => ['type' => 'int', 'not null' => true, 'description' => 'RefCount'], 'filehash' => ['type' => 'varchar', 'length' => 64, 'description' => 'sha256 of the file contents, if the file is stored locally'], - 'mimetype' => ['type' => 'varchar', 'length' => 64, 'description' => 'mime type of resource'], + 'mimetype' => ['type' => 'varchar', 'length' => 255, 'description' => 'resource mime type 127+1+127 as per rfc6838#section-4.2'], 'filename' => ['type' => 'varchar', 'length' => 191, 'description' => 'file name of resource when available'], 'size' => ['type' => 'int', 'description' => 'size of resource when available'], 'width' => ['type' => 'int', 'description' => 'width in pixels, if it can be described as such and data is available'],