Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit 57944d3

Browse files
committed
Change isSimple to allow >= 0x21 and <= 0x7e
1 parent a26e128 commit 57944d3

File tree

2 files changed

+3
-73
lines changed

2 files changed

+3
-73
lines changed

cmdutil/cmd.go

Lines changed: 1 addition & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -146,77 +146,5 @@ func isSimple(b []byte) bool {
146146
}
147147

148148
func isSimpleByte(c byte) bool {
149-
return simple[c]
150-
}
151-
152-
var simple = [256]bool{
153-
'-': true,
154-
'+': true,
155-
'_': true,
156-
':': true,
157-
158-
'0': true,
159-
'1': true,
160-
'2': true,
161-
'3': true,
162-
'4': true,
163-
'5': true,
164-
'6': true,
165-
'7': true,
166-
'8': true,
167-
'9': true,
168-
169-
'a': true,
170-
'b': true,
171-
'c': true,
172-
'd': true,
173-
'e': true,
174-
'f': true,
175-
'g': true,
176-
'h': true,
177-
'i': true,
178-
'j': true,
179-
'k': true,
180-
'l': true,
181-
'm': true,
182-
'n': true,
183-
'o': true,
184-
'p': true,
185-
'q': true,
186-
'r': true,
187-
's': true,
188-
't': true,
189-
'u': true,
190-
'v': true,
191-
'w': true,
192-
'x': true,
193-
'y': true,
194-
'z': true,
195-
196-
'A': true,
197-
'B': true,
198-
'C': true,
199-
'D': true,
200-
'E': true,
201-
'F': true,
202-
'G': true,
203-
'H': true,
204-
'I': true,
205-
'J': true,
206-
'K': true,
207-
'L': true,
208-
'M': true,
209-
'N': true,
210-
'O': true,
211-
'P': true,
212-
'Q': true,
213-
'R': true,
214-
'S': true,
215-
'T': true,
216-
'U': true,
217-
'V': true,
218-
'W': true,
219-
'X': true,
220-
'Y': true,
221-
'Z': true,
149+
return c >= 0x21 && c <= 0x7e
222150
}

cmdutil/cmd_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ var _ = Describe("AppendArg", func() {
2222

2323
Entry("", "-inf", "-inf"),
2424
Entry("", "+inf", "+inf"),
25+
Entry("", "foo.bar", "foo.bar"),
2526
Entry("", "foo:bar", "foo:bar"),
27+
Entry("", "foo{bar}", "foo{bar}"),
2628
Entry("", "foo-123_BAR", "foo-123_BAR"),
2729
Entry("", "foo\nbar", "666f6f0a626172"),
2830
Entry("", "\000", "00"),

0 commit comments

Comments
 (0)