Skip to content

Commit

Permalink
add a comment explaining fileSize
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Nov 24, 2021
1 parent d2bde17 commit 9144720
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions services/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const optionalDottedVersionNClausesWithOptionalSuffix =
// TODO This accepts URLs with query strings and fragments, which for some
// purposes should be rejected.
export const optionalUrl = Joi.string().uri({ scheme: ['http', 'https'] })

// validator for a file size we are going to pass to bytes.parse
// see https://github.com/visionmedia/bytes.js#bytesparsestringnumber-value-numbernull
export const fileSize = Joi.string()
.regex(/^[0-9]+(b|kb|mb|gb|tb)$/i)
.required()

0 comments on commit 9144720

Please sign in to comment.