forked from platformio/platformio-core
Escape non-valid file name characters when installing a new package (library) // Resolve #985
This commit is contained in:
@ -40,6 +40,8 @@ PlatformIO 3.0
|
||||
`issue #952 <https://github.com/platformio/platformio-core/issues/952>`_)
|
||||
* Don't warn about known ``boards_dir`` option
|
||||
(`pull #949 <https://github.com/platformio/platformio-core/pull/949>`_)
|
||||
* Escape non-valid file name characters when installing a new package (library)
|
||||
(`issue #985 <https://github.com/platformio/platformio-core/issues/985>`_)
|
||||
* Fixed infinite dependency installing when repository consists of multiple
|
||||
libraries
|
||||
(`issue #935 <https://github.com/platformio/platformio-core/issues/935>`_)
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user