Merge pull request #24370 from nextcloud/backport/21844/stable19
[stable19] Avoid substr() error when strpos returns false
This commit is contained in:
commit
35cc99fdf6
|
@ -379,6 +379,8 @@ class Detection implements IMimeTypeDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try only the first part of the filetype
|
// Try only the first part of the filetype
|
||||||
|
|
||||||
|
if (strpos($icon, '-')) {
|
||||||
$mimePart = substr($icon, 0, strpos($icon, '-'));
|
$mimePart = substr($icon, 0, strpos($icon, '-'));
|
||||||
try {
|
try {
|
||||||
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg');
|
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg');
|
||||||
|
@ -386,6 +388,7 @@ class Detection implements IMimeTypeDetector {
|
||||||
} catch (\RuntimeException $e) {
|
} catch (\RuntimeException $e) {
|
||||||
// Image for the first part of the mimetype not found
|
// Image for the first part of the mimetype not found
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg');
|
$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg');
|
||||||
return $this->mimetypeIcons[$mimetype];
|
return $this->mimetypeIcons[$mimetype];
|
||||||
|
|
Loading…
Reference in New Issue