Skip to content

Commit

Permalink
Revert "Correct base64 validation. Fixes #1055."
Browse files Browse the repository at this point in the history
This reverts commit a959139.
  • Loading branch information
Marsup committed Dec 5, 2016
1 parent 6fa10c5 commit 2e45cb3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion lib/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ internals.String = class extends Any {

base64() {

const regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)$/;
const regex = /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;

return this._test('base64', regex, function (value, state, options) {

Expand Down
1 change: 0 additions & 1 deletion test/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -3153,7 +3153,6 @@ describe('string', () => {
['YW', false, null, '"value" must be a valid base64 string'],
['YW==', true],
['YW5', false, null, '"value" must be a valid base64 string'],
['password', false, null, '"value" must be a valid base64 string'],
['YW5=', true],
['$#%#$^$^)(*&^%', false, null, '"value" must be a valid base64 string']
], done);
Expand Down

0 comments on commit 2e45cb3

Please sign in to comment.