protocollabs / hippod

A Test Aggregator for Distributed & Heterogeneous Test Environments
https://hgn.github.io/hippod/
MIT License
0 stars 4 forks source link

Snippet name (optional argument) SHOULD be a name, not necessarily a filename #64

Closed hgn closed 7 years ago

hgn commented 7 years ago
def save_snippet(app, mime_type, sha, name, data):
    f_type = name.split('.')[1]
    snippet_tmp_path = os.path.join('/tmp', 'tmp{}.{}'.format(sha, f_type))
    # snippet_tmp_path = os.path.join(tmp_path, name)
    data_decoded = hippod.hasher.decode_base64_data(data)
    data_decoded = data_decoded.decode('utf-8')
    with open(snippet_tmp_path, 'w') as file:
        file.write(data_decoded)
    return snippet_tmp_path

name.split will crash when name is not foo.png, whatever, but it should also be ok to be just foo.