Escape non-valid file name characters when installing a new package (library) // Resolve #985

This commit is contained in:
Ivan Kravets committed 2017-06-24 15:20:33 +03:00
1 parent f6960a0f98
commit d8a0272bec
2 files changed
+9 -2

No files matched your search

+7 -2
View File
@@ -126,6 +126,9 @@ class PkgRepoMixin(object):
class PkgInstallerMixin(object):
PATH_ESCAPE_CHARS = ("/", "\\", "?", "%", "*", ":", "|", '"', "<", ">",
".", "(", ")", "&", "#", ",", "'")
SRC_MANIFEST_NAME = ".piopkgmanager.json"
FILE_CACHE_VALID = "1m" # 1 month
@@ -189,9 +192,11 @@ class PkgInstallerMixin(object):
fu = FileUnpacker(source_path, dest_dir)
return fu.start()
@staticmethod
def get_install_dirname(manifest):
def get_install_dirname(self, manifest):
name = manifest['name']
for c in self.PATH_ESCAPE_CHARS:
if c in name:
name = name.replace(c, "_")
if "id" in manifest:
name += "_ID%d" % manifest['id']
return name