Skip to content

Commit

Permalink
@tus/server: update reMimeType por compliance with RFC1341
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusgoku committed Sep 26, 2024
1 parent 7952825 commit 9790f70
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/server/src/handlers/GetHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@ import type {RouteHandler} from '../types'
export class GetHandler extends BaseHandler {
paths: Map<string, RouteHandler> = new Map()

reMimeType = /^[a-z]+\/[a-z0-9\-\+\.]+$/
/**
* reMimeType is a RegExp for check mime-type form compliance with RFC1341
* for support mime-type and extra parameters, for example:
*
* ```
* text/plain; charset=utf-8
* ```
*
* See: https://datatracker.ietf.org/doc/html/rfc1341 (Page 6)
*/
reMimeType =
/^(?:application|audio|example|font|haptics|image|message|model|multipart|text|video|x-(?:[0-9A-Za-z!#$%&'*+.^_`|~-]+))\/([0-9A-Za-z!#$%&'*+.^_`|~-]+)((?:[ ]*;[ ]*[0-9A-Za-z!#$%&'*+.^_`|~-]+=(?:[0-9A-Za-z!#$%&'*+.^_`|~-]+|"(?:[^"\\]|\.)*"))*)$/

/**
* mimeInlineBrowserWhitelist is a set containing MIME types which should be
Expand Down

0 comments on commit 9790f70

Please sign in to comment.