diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-21 16:53:50 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-08-21 16:53:50 -0400 |
commit | a10b9ce7dab55490afc85b130852a64633863961 (patch) | |
tree | da1c38bb320072000c24d4b198de6290770738ab /buildstream/_artifactcache | |
parent | 6ba115065f8168fa1684be338a47f0a65ca3df79 (diff) | |
download | buildstream-a10b9ce7dab55490afc85b130852a64633863961.tar.gz |
artifactcache.py: Fix escaping of element names
Fixes issue #66
Diffstat (limited to 'buildstream/_artifactcache')
-rw-r--r-- | buildstream/_artifactcache/artifactcache.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/artifactcache.py b/buildstream/_artifactcache/artifactcache.py index 4ebc79848..3abecb103 100644 --- a/buildstream/_artifactcache/artifactcache.py +++ b/buildstream/_artifactcache/artifactcache.py @@ -21,6 +21,7 @@ import multiprocessing import os import sys +import string import tempfile from .. import _ostree, utils @@ -37,7 +38,11 @@ def buildref(element, key): project = element.get_project() # Normalize ostree ref unsupported chars - element_name = element.normal_name.replace('+', 'X') + valid_chars = string.digits + string.ascii_letters + '-._' + element_name = ''.join([ + x if x in valid_chars else '_' + for x in element.normal_name + ]) # assume project and element names are not allowed to contain slashes return '{0}/{1}/{2}'.format(project.name, element_name, key) |