preview = false;
}
+ var fileentry = $('<li>')
+ .attr('class', 'attachment')
+ .attr('style', 'text-align: center');
if (preview) {
blobAsDataURL(file, function (url) {
- var fileentry = $('<li>')
- .attr('class', 'attachment')
- .attr('style', 'text-align: center');
var img = $('<img>')
.attr('title', tooltip)
.attr('alt', tooltip)
form.find('.attach-status').append(fileentry);
});
} else {
- var img = $('<div></div>').text(tooltip);
- form.find('.attach-status').append(img);
+ fileentry.append($('<code>' + file.type + '</code>'));
+ fileentry.append($('<br><code>' + file.name + '</code>'));
+ form.find('.attach-status').append(fileentry);
}
},
}
function title() {
- return $this->attachment->getTitle() ?: _('Untitled attachment');
+ return $this->attachment->getTitle() ?: MediaFile::getDisplayName($this->attachment);
}
function linkTitle() {
define('GNUSOCIAL_ENGINE', 'GNU social');
define('GNUSOCIAL_ENGINE_URL', 'https://www.gnu.org/software/social/');
-define('GNUSOCIAL_BASE_VERSION', '1.21.1');
+define('GNUSOCIAL_BASE_VERSION', '1.21.2');
define('GNUSOCIAL_LIFECYCLE', 'dev'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);
return File_thumbnail::saveThumbnail(
$this->fileRecord->getID(),
- // no url since we generated it ourselves and can dynamically
- // generate the url
- null,
+ // no url since we generated it ourselves and can dynamically
+ // generate the url
+ null,
$width,
$height,
$outname
$mimetype = self::getUploadedMimeType($_FILES[$param]['tmp_name'], $_FILES[$param]['name']);
$media = common_get_mime_media($mimetype);
- $basename = preg_replace("/\..+$/i", '', basename($_FILES[$param]['name']));
- $ext = File::guessMimeExtension($mimetype, $basename);
+ $basename = basename($_FILES[$param]['name']);
if ($media === 'image') {
// Use -1 for the id to avoid adding this temporary file to the DB
$ext = image_type_to_extension($img->preferredType(), false);
}
+ // If we have a replacement extension (either from the config or from converting an image)
+ if ($ext !== false) {
+ $basename = preg_replace("/\..+$/i", ".{$ext}", $basename);
+ }
+
// New file name format
$original_filename = bin2hex("{$basename}.{$ext}");
$filename = "{$original_filename}-{$filehash}";
$ret = preg_match('/^[^\.]+\.(.+)$/', $file->filename, $matches);
if ($ret !== 1) {
common_log(LOG_ERR, $log_error_msg);
- throw new ServerException($user_error_msg);
+ return _('Untitled attachment');
}
$ext = $matches[1];
// Previously, there was a blacklisted extension array, which could have an alternative