Skip to content

Commit ecfca17

Browse files
committed
BugFix: Add location regex to finding a key for cache.
1 parent 340bdb9 commit ecfca17

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

coc/cache.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@
99
log = logging.getLogger(__name__)
1010

1111

12-
def validate_tag(tag):
12+
def validate_tag(string):
1313
# Legal clan tags only have these characters:
1414
# Numbers: 0, 2, 8, 9
1515
# Letters: P, Y, L, Q, G, R, J, C, U, V
16-
if not isinstance(tag, str):
16+
if not isinstance(string, str):
1717
return False
18-
match = re.match("^#[PYLQGRJCUV0289]+$", tag)
19-
return True if match else False
18+
19+
match = re.match("(?P<tag>^\s*#?[PYLQGRJCUV0289]+\s*$)|(?P<location>\d{1,10})", string)
20+
21+
if match.group('tag'):
22+
return True
23+
if match.group('location'):
24+
return True
25+
26+
return False
2027

2128

2229
def find_key(args, kwargs):

0 commit comments

Comments
 (0)