Skip to content

Commit ba9efe3

Browse files
committed
deal with special characters in program and user names
1 parent a420772 commit ba9efe3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ide/routes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import flask
4040
import traceback
4141
import functools
42+
import urllib.parse
4243

4344
from google.cloud import ndb
4445
from google.auth.transport import requests
@@ -341,7 +342,13 @@ def parseUrlPath(theRegexp, numGroups):
341342
for i in range(numGroups):
342343
value = m.group(i+1)
343344
if value:
344-
names[i] = value
345+
newValue = []
346+
for char in value:
347+
if char == '%' or char in unreserved:
348+
newValue.append(char)
349+
else:
350+
newValue.append(urllib.parse.quote(char))
351+
names[i] = ''.join(newValue)
345352
except:
346353
raise ParseUrlPathException('Parsing URL failed', 400)
347354

0 commit comments

Comments
 (0)