Fix #8262: properly account for requests with query and no body

This commit is contained in:
Ofek Shilon
2025-11-08 15:04:33 +02:00
parent 54e28ce441
commit a4281bb468
+4 -4
View File
@@ -159,25 +159,25 @@ export class NoScriptHandler {
async handleShareLink(req: express.Request, res: express.Response) {
// Getting form data with proper type checking - handle both GET and POST
const source =
typeof req.body.source === 'string'
typeof req.body?.source === 'string'
? req.body.source
: typeof req.query.source === 'string'
? req.query.source
: '';
const compiler =
typeof req.body.compiler === 'string'
typeof req.body?.compiler === 'string'
? req.body.compiler
: typeof req.query.compiler === 'string'
? req.query.compiler
: '';
const userArguments =
typeof req.body.userArguments === 'string'
typeof req.body?.userArguments === 'string'
? req.body.userArguments
: typeof req.query.userArguments === 'string'
? req.query.userArguments
: '';
const language =
typeof req.body.lang === 'string'
typeof req.body?.lang === 'string'
? req.body.lang
: typeof req.query.language === 'string'
? req.query.language