* 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
}
uploadsController.getUniqueRandomName = (length, extension = '', cb) => {
uploadsController.getUniqueRandomName = (length, extension, cb) => {
const access = i => {
const name = randomstring.generate(length) + extension
fs.access(path.join(uploadDir, name), error => {
@ -566,9 +566,9 @@ uploadsController.list = async (req, res) => {
}
}
const ext = path.extname(file.name).toLowerCase()
const isVideoExt = utils.videoExtensions.includes(ext)
const isImageExt = utils.imageExtensions.includes(ext)
file.extname = path.extname(file.name).toLowerCase()
const isVideoExt = utils.videoExtensions.includes(file.extname)
const isImageExt = utils.imageExtensions.includes(file.extname)
if ((!isVideoExt && !isImageExt) ||
(isVideoExt && config.uploads.generateThumbnails.video !== true) ||
@ -576,7 +576,7 @@ uploadsController.list = async (req, res) => {
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

View File

@ -196,7 +196,7 @@ panel.getUploads = (album, page, element) => {
if (file.thumb !== undefined) {
div.innerHTML = `<a class="image" href="${file.file}" target="_blank"><img src="${file.thumb}"/></a>`
} 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 += `
<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,
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.