Updated uploadController.js

String updates.
This commit is contained in:
Bobby Wibowo 2019-11-10 03:41:54 +07:00
parent a28d862c14
commit b646a4a82f
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -204,7 +204,7 @@ self.upload = async (req, res, next) => {
if (temporaryUploads) { if (temporaryUploads) {
age = self.parseUploadAge(req.headers.age) age = self.parseUploadAge(req.headers.age)
if (!age && !config.uploads.temporaryUploadAges.includes(0)) if (!age && !config.uploads.temporaryUploadAges.includes(0))
return res.json({ success: false, description: 'Permanent uploads are prohibited.' }) return res.json({ success: false, description: 'Permanent uploads are not permitted.' })
} }
try { try {
@ -309,7 +309,7 @@ self.actuallyUploadUrls = async (req, res, user, albumid, age) => {
filtered = self.isExtensionFiltered(extname) filtered = self.isExtensionFiltered(extname)
if (filtered) if (filtered)
throw `${extname ? `${extname.substr(1).toUpperCase()} files` : 'Files with no extension'} are not permitted due to security reasons.` throw `${extname ? `${extname.substr(1).toUpperCase()} files` : 'Files with no extension'} are not permitted.`
if (config.uploads.urlProxy) if (config.uploads.urlProxy)
url = config.uploads.urlProxy url = config.uploads.urlProxy
@ -413,12 +413,12 @@ self.actuallyFinishChunks = async (req, res, user) => {
file.extname = typeof file.original === 'string' ? utils.extname(file.original) : '' file.extname = typeof file.original === 'string' ? utils.extname(file.original) : ''
if (self.isExtensionFiltered(file.extname)) if (self.isExtensionFiltered(file.extname))
throw `${file.extname ? `${file.extname.substr(1).toUpperCase()} files` : 'Files with no extension'} are not permitted due to security reasons.` throw `${file.extname ? `${file.extname.substr(1).toUpperCase()} files` : 'Files with no extension'} are not permitted.`
if (temporaryUploads) { if (temporaryUploads) {
file.age = self.parseUploadAge(file.age) file.age = self.parseUploadAge(file.age)
if (!file.age && !config.uploads.temporaryUploadAges.includes(0)) if (!file.age && !config.uploads.temporaryUploadAges.includes(0))
throw 'Permanent uploads are prohibited.' throw 'Permanent uploads are not permitted.'
} }
file.size = chunksData[file.uuid].size file.size = chunksData[file.uuid].size