Skip to content

Validate base64 URI safe strings #1746

@tswindell

Description

@tswindell

Context

  • node v10.15.3
  • joi 14.3.1
  • node
  • express

What are you trying to achieve or the steps to reproduce ?

I'm attempting to validate a Base64 encoded string in the URL/Filename Safe profile. The spec defines this as:

NOTE: In the URL and Filename safe variant, character 62 (0x3E) is replaced with a "-" (minus sign) and character 63 (0x3F) is replaced with a "_" (underscore).
const schema = Joi.string().base64({paddingRequired: false}).validate('BMGzZagVwSz0WQl3DLrvdWI1HSNS9bO5kTp8tQf2ldEexg_sYGOQoi7hz7Uc0PUHRoCkHAjrTke5eY2H9beUYPI')

Which result you had ?

Validation Fails

What did you expect ?

Validation Should Succeed

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions