damn spaniards

jschan
Thomas Lynch 3 years ago
parent 20fcf19a27
commit bbd06b31af
No known key found for this signature in database
GPG Key ID: FBAB081F9B6E14B2
  1. 7
      CHANGELOG.md
  2. 8
      helpers/files/mimetypes.js
  3. 10
      models/forms/addassets.js
  4. 4
      models/forms/addflags.js
  5. 4
      models/forms/makepost.js
  6. 10
      models/forms/uploadbanners.js
  7. 2
      package.json

@ -68,3 +68,10 @@
- Multiple files & post flags now shown in catalog view
- Faster, more efficient global settings changes
- Add option for board owner to prevent OP deleting threads that are too old or have too many replies
### 0.1.9
- Fix "improved" global settings changes not regenerating custom pages properly
- Postmenu dropdown for filters/moderate added to catalog tiles
- Notifications are no longer sent for posts when clicking "view full text"
- Make handling files with no/incorrect extension better
- Image count from OP is included in catalog tiles file count

@ -53,10 +53,12 @@ module.exports = {
realMimeCheck: async (file) => {
const supposedMimeType = file.mimetype;
const realMimeType = await FileType.fromFile(file.tempFilePath);
if (!realMimeType) {
return config.get.allowMimeNoMatch;
if (realMimeType) {
//note the correct file extension in case it is incorrect/missing
file.extension = `.${realMimeType.ext}`;
return supposedMimeType === realMimeType.mime;
}
return supposedMimeType === realMimeType.mime;
return config.get.allowMimeNoMatch;
},
image, animatedImage, video, audio, other

@ -48,11 +48,11 @@ module.exports = async (req, res, next) => {
const filenames = [];
for (let i = 0; i < res.locals.numFiles; i++) {
const file = req.files.file[i];
const filename = file.sha256 + path.extname(file.name);
file.filename = filename;
const extension = file.extension || path.extname(file.name);
file.filename = file.sha256 + extension;
//check if already exists
const exists = await pathExists(`${uploadDirectory}/asset/${req.params.board}/${filename}`);
const exists = await pathExists(`${uploadDirectory}/asset/${req.params.board}/${file.filename}`);
if (exists) {
await remove(file.tempFilePath);
@ -60,10 +60,10 @@ module.exports = async (req, res, next) => {
}
//add to list after checking it doesnt already exist
filenames.push(filename);
filenames.push(file.filename);
//then upload it
await moveUpload(file, filename, `asset/${req.params.board}`);
await moveUpload(file, file.filename, `asset/${req.params.board}`);
//and delete the temp file
await remove(file.tempFilePath);

@ -53,6 +53,8 @@ module.exports = async (req, res, next) => {
const newFlags = {};
for (let i = 0; i < res.locals.numFiles; i++) {
const file = req.files.file[i];
const extension = file.extension || path.extname(file.name);
file.filename = file.sha256 + extension;
let noExt = path.parse(file.name).name;
//match case for real country flags
@ -64,7 +66,7 @@ module.exports = async (req, res, next) => {
newFlags[noExt] = file.name;
//then upload it
await moveUpload(file, file.name, `flag/${req.params.board}`);
await moveUpload(file, file.filename, `flag/${req.params.board}`);
//and delete the temp file
await remove(file.tempFilePath);

@ -236,14 +236,14 @@ ${res.locals.numFiles > 0 ? req.files.file.map(f => f.name+'|'+(f.phash || '')).
//upload, create thumbnails, get metadata, etc.
for (let i = 0; i < res.locals.numFiles; i++) {
const file = req.files.file[i];
let extension = path.extname(file.name) || file.name.substring(file.name.indexOf('.'));
const extension = file.extension || path.extname(file.name);
file.filename = file.sha256 + extension;
//get metadata
let processedFile = {
filename: file.filename,
spoiler: (res.locals.permLevel >= 4 || userPostSpoiler) && req.body.spoiler && req.body.spoiler.includes(file.sha256),
hash: file.sha256,
filename: file.filename, //could probably remove since we have hash and extension
originalFilename: req.body.strip_filename && req.body.strip_filename.includes(file.sha256) ? file.filename : file.name,
mimetype: file.mimetype,
size: file.size,

@ -68,11 +68,11 @@ module.exports = async (req, res, next) => {
const filenames = [];
for (let i = 0; i < res.locals.numFiles; i++) {
const file = req.files.file[i];
const filename = file.sha256 + path.extname(file.name);
file.filename = filename;
const extension = file.extension || path.extname(file.name);
file.filename = file.sha256 + extension;
//check if already exists
const exists = await pathExists(`${uploadDirectory}/banner/${req.params.board}/${filename}`);
const exists = await pathExists(`${uploadDirectory}/banner/${req.params.board}/${file.filename}`);
if (exists) {
await remove(file.tempFilePath);
@ -80,10 +80,10 @@ module.exports = async (req, res, next) => {
}
//add to list after checking it doesnt already exist
filenames.push(filename);
filenames.push(file.filename);
//then upload it
await moveUpload(file, filename, `banner/${req.params.board}`);
await moveUpload(file, file.filename, `banner/${req.params.board}`);
//and delete the temp file
await remove(file.tempFilePath);

@ -1,6 +1,6 @@
{
"name": "jschan",
"version": "0.1.8",
"version": "0.1.9",
"migrateVersion": "0.1.8",
"description": "",
"main": "server.js",

Loading…
Cancel
Save