aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/OC_Image.php
diff options
context:
space:
mode:
authorJ0WI <J0WI@users.noreply.github.com>2022-09-02 21:47:38 +0200
committerJ0WI <J0WI@users.noreply.github.com>2022-12-04 14:51:33 +0100
commit110ea0df46420e61d4e11954b27f333541ef3bfe (patch)
tree046b5f4e81384b491f435ac09c4745b784ffbc43 /lib/private/legacy/OC_Image.php
parent1dd3afefcd6ebb36f68dd5c0107faba6f62a1948 (diff)
downloadnextcloud-server-110ea0df46420e61d4e11954b27f333541ef3bfe.tar.gz
nextcloud-server-110ea0df46420e61d4e11954b27f333541ef3bfe.zip
Allow empty mimeType
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
Diffstat (limited to 'lib/private/legacy/OC_Image.php')
-rw-r--r--lib/private/legacy/OC_Image.php15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index 1e6ff72fb42..9ccc6409ba0 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -60,7 +60,7 @@ class OC_Image implements \OCP\IImage {
protected $resource = false; // tmp resource.
/** @var int */
protected $imageType = IMAGETYPE_PNG; // Default to png if file type isn't evident.
- /** @var string */
+ /** @var null|string */
protected $mimeType = 'image/png'; // Default to png
/** @var null|string */
protected $filePath = null;
@@ -116,12 +116,12 @@ class OC_Image implements \OCP\IImage {
}
/**
- * Returns the MIME type of the image or an empty string if no image is loaded.
+ * Returns the MIME type of the image or null if no image is loaded.
*
* @return string
*/
- public function mimeType(): string {
- return $this->valid() ? $this->mimeType : '';
+ public function mimeType(): ?string {
+ return $this->valid() ? $this->mimeType : null;
}
/**
@@ -354,12 +354,11 @@ class OC_Image implements \OCP\IImage {
}
/**
- * @return string Returns the mimetype of the data. Returns the empty string
- * if the data is not valid.
+ * @return string Returns the mimetype of the data. Returns null if the data is not valid.
*/
- public function dataMimeType(): string {
+ public function dataMimeType(): ?string {
if (!$this->valid()) {
- return '';
+ return null;
}
switch ($this->mimeType) {