CodeGenieApp / CodeGenieApp/serverless-express
Binary Content Type with Dots or Other Regex
- Lingua principale
- JavaScript
- Stelle
- 5.3k
- Fork
- 676
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The [`is-binary.js`](https://github.com/brettstack/serverless-express/blob/mainline/src/is-binary.js#L24) checker converts the developer-specified content types to Regex without escaping them, which is can cause overly broad selection or other issues during the Regex match.
For example, the following binary selector for an XLSX document (`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet `) will match any character at the `.` of this content type, and also leads the tailing asterisk to become `..*`
```js
export const handler = serverlessExpress({
app,
binarySettings: {
contentTypes: [
'application/pdf',
'application/vnd.openxmlformats-officedocument.*'
]
}
});
```
I think developers would generally expect to either pass their own Regex, or for the `*` character to be the only recognized character (and possibly other glob patterns, but not all of Regex).
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.