Fix body limit

main
radex 2024-02-01 17:48:35 +01:00
parent 8c8cea6eb6
commit 8d66083f18
Signed by: radex
SSH Key Fingerprint: SHA256:hvqRXAGG1h89yqnS+cyFTLKQbzjWD4uXIqw7Y+0ws30
1 changed files with 1 additions and 4 deletions

View File

@ -106,7 +106,7 @@ app.get('/printers/:name/jobs', (req, res) => {
// --- Print API ---
app.post('/print', bodyParser.raw({ type: '*/*' }), (req, res) => {
app.post('/print', bodyParser.raw({ type: '*/*', limit: 10_000_000 }), (req, res) => {
const { body, query } = req
console.log("Received print job: ", { body, query })
@ -134,9 +134,6 @@ app.post('/print', bodyParser.raw({ type: '*/*' }), (req, res) => {
} else if (body.subarray(0, 4).toString() !== "%PDF") {
res.status(415).send("Data does not look like a PDF, please send a PDF")
return
} else if (body.length > 10_000_000) {
res.status(413).send("Data too large (limit: 10MB), please send a smaller PDF")
return
}
// send print job