Fix relocate.mime_type if slashes in subtype (#11788)

If the mimetype returned from `file -h -b --mime-type` contains slashes
in its subtype, the tuple returned from `spack.relocate.mime_type` will
have a size larger than two, which leads to errors.

Change-Id: I31de477e69f114ffdc9ae122d00c573f5f749dbb
This commit is contained in:
Oliver Breitwieser 2020-02-20 00:30:17 +01:00 committed by GitHub
parent 8825335056
commit 65133daad7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -749,4 +749,5 @@ def mime_type(file):
tty.debug('[MIME_TYPE] {0} -> {1}'.format(file, output.strip()))
if '/' not in output:
output += '/'
return tuple(output.strip().split('/'))
split_by_slash = output.strip().split('/')
return (split_by_slash[0], "/".join(split_by_slash[1:]))