Skip to content

Commit

Permalink
fix #26 add null check for filename
Browse files Browse the repository at this point in the history
  • Loading branch information
reaby committed Oct 21, 2022
1 parent 0222095 commit bd84cff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion routes/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export default function (pluginManager, websocket, dispatcher) {

req.busboy.on('file', function (fieldname, file, details) {
if (fieldname === "newBackground")
if (details.filename.length > 0 && (details.mimeType === "image/jpeg" || details.mimeType === "video/mp4" || details.mimeType === "image/png")) {
if (details.filename && details.filename.length > 0 && (details.mimeType === "image/jpeg" || details.mimeType === "video/mp4" || details.mimeType === "image/png")) {
let fstream = fs.createWriteStream('./data/backgrounds/' + details.filename);
file.pipe(fstream);
} else {
Expand Down

0 comments on commit bd84cff

Please sign in to comment.