[PATCH] D43009: [clangd] Do not precent-encode numbers in URI.

Eric Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 04:15:36 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL324475: [clangd] Do not precent-encode numbers in URI. (authored by ioeric, committed by ).
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D43009

Files:
  clang-tools-extra/trunk/clangd/URI.cpp
  clang-tools-extra/trunk/unittests/clangd/URITests.cpp


Index: clang-tools-extra/trunk/unittests/clangd/URITests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/URITests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/URITests.cpp
@@ -72,6 +72,7 @@
 TEST(PercentEncodingTest, Encode) {
   EXPECT_EQ(URI("x", /*Authority=*/"", "a/b/c").toString(), "x:a/b/c");
   EXPECT_EQ(URI("x", /*Authority=*/"", "a!b;c~").toString(), "x:a%21b%3bc~");
+  EXPECT_EQ(URI("x", /*Authority=*/"", "a123b").toString(), "x:a123b");
 }
 
 TEST(PercentEncodingTest, Decode) {
Index: clang-tools-extra/trunk/clangd/URI.cpp
===================================================================
--- clang-tools-extra/trunk/clangd/URI.cpp
+++ clang-tools-extra/trunk/clangd/URI.cpp
@@ -79,7 +79,8 @@
 
 bool shouldEscape(unsigned char C) {
   // Unreserved characters.
-  if ((C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z'))
+  if ((C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
+      (C >= '0' && C <= '9'))
     return false;
   switch (C) {
   case '-':


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43009.133195.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180207/49f70231/attachment.bin>


More information about the llvm-commits mailing list