Match uppercase file names and extensions

This commit is contained in:
JC Brand 2018-09-06 13:57:19 +02:00
parent c7ae188002
commit 9da214fb76
2 changed files with 20 additions and 15 deletions

12
dist/converse.js vendored
View File

@ -80956,22 +80956,24 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
u.renderFileURL = function (_converse, url) {
const uri = new URI(url),
__ = _converse.__,
filename = uri.filename();
filename = uri.filename(),
lower_filename = filename.toLowerCase();
if (!_.includes(["https", "http"], uri.protocol()) || filename.endsWith('mp3') || filename.endsWith('mp4') || filename.endsWith('jpg') || filename.endsWith('jpeg') || filename.endsWith('png') || filename.endsWith('gif') || filename.endsWith('svg')) {
if (!_.includes(["https", "http"], uri.protocol().toLowerCase()) || lower_filename.endsWith('mp3') || lower_filename.endsWith('mp4') || lower_filename.endsWith('jpg') || lower_filename.endsWith('jpeg') || lower_filename.endsWith('png') || lower_filename.endsWith('gif') || lower_filename.endsWith('svg')) {
return url;
}
return tpl_file({
'url': url,
'label_download': __('Download "%1$s"', filename)
'label_download': __('Download "%1$s"', uri.filename())
});
};
u.renderImageURL = function (_converse, url) {
const __ = _converse.__;
const __ = _converse.__,
lurl = url.toLowerCase();
if (url.endsWith('jpg') || url.endsWith('jpeg') || url.endsWith('png') || url.endsWith('gif') || url.endsWith('svg')) {
if (lurl.endsWith('jpg') || lurl.endsWith('jpeg') || lurl.endsWith('png') || lurl.endsWith('gif') || lurl.endsWith('svg')) {
return tpl_image({
'url': url,
'label_download': __('Download')

View File

@ -308,25 +308,28 @@
u.renderFileURL = function (_converse, url) {
const uri = new URI(url),
{ __ } = _converse,
filename = uri.filename();
if (!_.includes(["https", "http"], uri.protocol()) ||
filename.endsWith('mp3') || filename.endsWith('mp4') ||
filename.endsWith('jpg') || filename.endsWith('jpeg') ||
filename.endsWith('png') || filename.endsWith('gif') ||
filename.endsWith('svg')) {
filename = uri.filename(),
lower_filename = filename.toLowerCase();
if (!_.includes(["https", "http"], uri.protocol().toLowerCase()) ||
lower_filename.endsWith('mp3') || lower_filename.endsWith('mp4') ||
lower_filename.endsWith('jpg') || lower_filename.endsWith('jpeg') ||
lower_filename.endsWith('png') || lower_filename.endsWith('gif') ||
lower_filename.endsWith('svg')) {
return url;
}
return tpl_file({
'url': url,
'label_download': __('Download "%1$s"', filename)
'label_download': __('Download "%1$s"', uri.filename())
})
};
u.renderImageURL = function (_converse, url) {
const { __ } = _converse;
if (url.endsWith('jpg') || url.endsWith('jpeg') || url.endsWith('png') ||
url.endsWith('gif') || url.endsWith('svg')) {
const { __ } = _converse,
lurl = url.toLowerCase();
if (lurl.endsWith('jpg') || lurl.endsWith('jpeg') || lurl.endsWith('png') ||
lurl.endsWith('gif') || lurl.endsWith('svg')) {
return tpl_image({
'url': url,