Upload debug assets with series / title including dot or slash did not add iteration index to the filename

This commit is contained in:
allegroai 2020-04-16 16:49:21 +03:00
parent f7b80a0da2
commit 466b2859d9

View File

@ -214,11 +214,14 @@ class UploadEvent(MetricsEventAdapter):
# get upload uri upfront, either predefined image format or local file extension # get upload uri upfront, either predefined image format or local file extension
# e.g.: image.png -> .png or image.raw.gz -> .raw.gz # e.g.: image.png -> .png or image.raw.gz -> .raw.gz
image_format = kwargs.pop('override_filename_ext', None) filename_ext = kwargs.pop('override_filename_ext', None)
if image_format is None: if filename_ext is None:
image_format = self._format.lower() if self._image_data is not None else \ filename_ext = self._format.lower() if self._image_data is not None else \
'.' + '.'.join(pathlib2.Path(self._local_image_path).parts[-1].split('.')[1:]) '.' + '.'.join(pathlib2.Path(self._local_image_path).parts[-1].split('.')[1:])
self._upload_filename = str(pathlib2.Path(self._filename).with_suffix(image_format)) # always add file extension to the uploaded target file
if filename_ext and filename_ext[0] != '.':
filename_ext = '.' + filename_ext
self._upload_filename = pathlib2.Path(self._filename).as_posix() + filename_ext
self._override_storage_key_prefix = kwargs.pop('override_storage_key_prefix', None) self._override_storage_key_prefix = kwargs.pop('override_storage_key_prefix', None)