Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Unified Diff: lib/src/percent/encoder.dart

Issue 2225763002: Fix percent encoding to not encode digits. (Closed) Base URL: https://github.com/dart-lang/convert@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/percent/encoder.dart
diff --git a/lib/src/percent/encoder.dart b/lib/src/percent/encoder.dart
index c7817609e81c8adc762619d3d7ebd253d4ae7daa..9d05c21c582a5741a823683b8cb03c3d106504f8 100644
--- a/lib/src/percent/encoder.dart
+++ b/lib/src/percent/encoder.dart
@@ -66,7 +66,12 @@ String _convert(List<int> bytes, int start, int end) {
// exactly `0b100000 = 0x20` less than lowercase letters, so if we ensure
// that that bit is 1 we ensure that the letter is lowercase.
var letter = 0x20 | byte;
+ // If the byte is a digit, convert it to its value. All other byte values
+ // are converted to a value greater than 9.
+ // Negative values are detected elsewhere.
+ var digit = 0x30 ^ byte;
if ((letter >= $a && letter <= $z) ||
+ digit <= 9 ||
byte == $dash ||
byte == $dot ||
byte == $underscore ||
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698