From a10b9ce7dab55490afc85b130852a64633863961 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Mon, 21 Aug 2017 16:53:50 -0400 Subject: artifactcache.py: Fix escaping of element names Fixes issue #66 --- buildstream/_artifactcache/artifactcache.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'buildstream/_artifactcache') 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) -- cgit v1.2.1