--- /dev/null
+<?php
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+/**
+ * Class for unknown extension MIME type exception
+ *
+ * Thrown when we don't know the MIME type for a given file extension.
+ *
+ * @category Exception
+ * @package GNUsocial
+ * @author Mikael Nordfeldth <mmn@hethane.se>
+ * @license https://www.gnu.org/licenses/agpl-3.0.html
+ * @link https://gnu.io/social
+ */
+
+class UnknownExtensionMimeException extends ServerException
+{
+ public function __construct($ext)
+ {
+ // TRANS: We accept the file type (we probably just accept all files)
+ // TRANS: but don't know the file extension for it. %1$s is the extension.
+ $msg = sprintf(_('Unknown MIME type for file extension: %1$s'), _ve($ext));
+
+ parent::__construct($msg);
+ }
+}
class UnknownMimeExtensionException extends ServerException
{
- public function __construct($msg=null)
+ public function __construct($mimetype)
{
- if ($msg === null) {
- // TRANS: We accept the file type (we probably just accept all files)
- // TRANS: but don't know the file extension for it.
- $msg = _('Supported mimetype but unknown extension relation.');
- }
-
+ // TRANS: We accept the file type (we probably just accept all files)
+ // TRANS: but don't know the file extension for it.
+ $msg = sprintf(_('Supported mimetype but unknown extension relation: %1$s'), _ve($mimetype));
parent::__construct($msg);
}
}
$supported = common_config('attachments', 'supported');
if ($supported === true) {
- throw new ServerException('Supported extension but unknown mimetype relation.');
+ throw new UnknownExtensionMimeException($fileext);
}
foreach($supported as $type => $ext) {
if ($ext === $fileext) {
{
$supported = common_config('attachments', 'supported');
if ($supported === true) {
- throw new UnknownMimeExtensionException();
+ throw new UnknownMimeExtensionException($mimetype);
}
foreach($supported as $type => $ext) {
if ($mimetype === $type) {