summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2017-03-06 12:44:34 +0000
committerBen Brown <ben.brown@codethink.co.uk>2017-03-06 14:20:15 +0000
commit48ba9abb2865810373b065854dc4965cf031bfd5 (patch)
tree2ab29922e41bafe26a878805563fa7cd3741e385
parent54fb9ab613fc7a3aa202180461758d5a1c4a6363 (diff)
downloadybd-benbrown/remove-restrictions.tar.gz
Set kbas to be less restrictive on allowed filenamesbenbrown/remove-restrictions
ybd makes no attempt to escape filenames for the restrictions set by kbas, thus certain chunks can end up being built every time. Loosen restrictions set by the kbas regex to fix such cases: [libdbus-c++] Starting upload [libdbus-c++] Artifact server problem: 400 [libdbus-c++] Failed to upload libdbus-c++.joidja8
-rwxr-xr-xkbas/__main__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py
index 4445f67..107f73f 100755
--- a/kbas/__main__.py
+++ b/kbas/__main__.py
@@ -19,6 +19,7 @@ import os
import re
import glob
import shutil
+from unicodedata import category
from time import strftime, gmtime
from datetime import datetime
import tempfile
@@ -127,7 +128,8 @@ class KeyedBinaryArtifactServer(object):
return
cache_id = request.forms.get('filename')
- if re.match('^[a-zA-Z0-9\.\-\_\@]*$', cache_id) is None:
+ if any(category(c)[0] == "C" for c in cache_id) or \
+ re.match('^[^/]*$', cache_id) is None:
response.status = 400 # bad request, cache_id contains bad things
return