Skip to content

Commit

Permalink
Other: Ensured that pbjs' beautify does not break regular expressions…
Browse files Browse the repository at this point in the history
… in generated verify functions
  • Loading branch information
dcodeIO committed Jan 12, 2017
1 parent 3946e0f commit 44167db
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions dist/noparse/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/noparse/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/noparse/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/noparse/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/noparse/protobuf.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/protobuf.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/protobuf.min.js

Large diffs are not rendered by default.

Binary file modified dist/protobuf.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/protobuf.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/runtime/protobuf.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/runtime/protobuf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/runtime/protobuf.min.js.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ function genVerifyKey(gen, field, ref) {
case "sint32":
case "fixed32":
case "sfixed32": gen
("if(!/^-?(?:0|[1-9]\\d*)$/.test(%s))", ref)
("if(!/^-?(?:0|[1-9][0-9]*)$/.test(%s))", ref) // it's important not to use any literals here that might be confused with short variable names by pbjs' beautify
("return%j", invalid(field, "integer key"));
break;
case "int64":
case "uint64":
case "sint64":
case "fixed64":
case "sfixed64": gen
("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9]\\d*))$/.test(%s))", ref)
("if(!/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/.test(%s))", ref) // see comment above: x is ok, d is not
("return%j", invalid(field, "integer|Long key"));
break;
case "bool": gen
Expand Down

0 comments on commit 44167db

Please sign in to comment.