* Dashboard will now display "N/A" when the file does not have an extension. Previously it would display the full name, which was of course a mistake.

* Updated static files' version string again.
This commit is contained in:
Bobby Wibowo 2018-04-25 20:39:07 +07:00
parent 5bb960756f
commit 00d05ce97b
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
3 changed files with 7 additions and 7 deletions

View File

@ -101,7 +101,7 @@ uploadsController.getFileNameLength = req => {
return config.uploads.fileLength.default || 32 return config.uploads.fileLength.default || 32
} }
uploadsController.getUniqueRandomName = (length, extension = '', cb) => { uploadsController.getUniqueRandomName = (length, extension, cb) => {
const access = i => { const access = i => {
const name = randomstring.generate(length) + extension const name = randomstring.generate(length) + extension
fs.access(path.join(uploadDir, name), error => { fs.access(path.join(uploadDir, name), error => {
@ -566,9 +566,9 @@ uploadsController.list = async (req, res) => {
} }
} }
const ext = path.extname(file.name).toLowerCase() file.extname = path.extname(file.name).toLowerCase()
const isVideoExt = utils.videoExtensions.includes(ext) const isVideoExt = utils.videoExtensions.includes(file.extname)
const isImageExt = utils.imageExtensions.includes(ext) const isImageExt = utils.imageExtensions.includes(file.extname)
if ((!isVideoExt && !isImageExt) || if ((!isVideoExt && !isImageExt) ||
(isVideoExt && config.uploads.generateThumbnails.video !== true) || (isVideoExt && config.uploads.generateThumbnails.video !== true) ||
@ -576,7 +576,7 @@ uploadsController.list = async (req, res) => {
continue continue
} }
file.thumb = `${basedomain}/thumbs/${file.name.slice(0, -ext.length)}.png` file.thumb = `${basedomain}/thumbs/${file.name.slice(0, -file.extname.length)}.png`
} }
// If we are a normal user, send response // If we are a normal user, send response

View File

@ -196,7 +196,7 @@ panel.getUploads = (album, page, element) => {
if (file.thumb !== undefined) { if (file.thumb !== undefined) {
div.innerHTML = `<a class="image" href="${file.file}" target="_blank"><img src="${file.thumb}"/></a>` div.innerHTML = `<a class="image" href="${file.file}" target="_blank"><img src="${file.thumb}"/></a>`
} else { } else {
div.innerHTML = `<a class="image" href="${file.file}" target="_blank"><h1 class="title">.${file.file.split('.').pop()}</h1></a>` div.innerHTML = `<a class="image" href="${file.file}" target="_blank"><h1 class="title">${file.extname || 'N/A'}</h1></a>`
} }
div.innerHTML += ` div.innerHTML += `
<input type="checkbox" class="file-checkbox" title="Select this file" data-id="${file.id}" onclick="panel.selectFile(this, event)"${selected ? ' checked' : ''}> <input type="checkbox" class="file-checkbox" title="Select this file" data-id="${file.id}" onclick="panel.selectFile(this, event)"${selected ? ' checked' : ''}>

View File

@ -10,7 +10,7 @@
This will be appended to all CSS and JS files, This will be appended to all CSS and JS files,
and should be changed on every updates to make sure clients load the very latest version of them. and should be changed on every updates to make sure clients load the very latest version of them.
#} #}
{% set v = "aSRDjST7cs" %} {% set v = "EnjDlj85EZ" %}
{# {#
These will be the links in the homepage and the No-JS uploader. These will be the links in the homepage and the No-JS uploader.