diff --git a/lib/commands/upload/snapshots/snapshots.rb b/lib/commands/upload/snapshots/snapshots.rb index 07588a4..bac78d7 100644 --- a/lib/commands/upload/snapshots/snapshots.rb +++ b/lib/commands/upload/snapshots/snapshots.rb @@ -210,11 +210,14 @@ def batch_upload_images(run_id, image_files, client) } used_filenames, = check_duplicate_files(image_files, client) + file_info_map = {} @profiler.measure('process_image_metadata') do image_files.each do |image_path| metadata_semaphore.async do file_info = client.parse_file_info(image_path) + file_name_without_extension = File.basename(file_info[:file_name], '.*') + file_info_map[image_path] = file_info dimensions = @profiler.measure('chunky_png_processing') do datastream = ChunkyPNG::Datastream.from_file(image_path) @@ -225,15 +228,14 @@ def batch_upload_images(run_id, image_files, client) end metadata = { - fileName: file_info[:file_name], + fileName: file_name_without_extension, groupName: file_info[:group_name], displayName: file_info[:variant_name], width: dimensions[:width], height: dimensions[:height] } - image_name = File.basename(image_path, '.*') - image_metadata[:images][image_name] = metadata + image_metadata[:images][file_name_without_extension] = metadata end end @@ -246,9 +248,9 @@ def batch_upload_images(run_id, image_files, client) zipfile.get_output_stream('manifest.json') { |f| f.write(JSON.generate(image_metadata)) } image_files.each do |image_path| - filename = File.basename(image_path) - # Only add files we haven't seen before - zipfile.add(filename, image_path) if used_filenames[filename] == image_path + file_info = file_info_map[image_path] + # Only add files we haven't seen before, otherwise it will crash + zipfile.add(file_info[:file_name], image_path) if used_filenames[file_info[:file_name]] == image_path end end end diff --git a/lib/version.rb b/lib/version.rb index 7eb81b8..52d7a57 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,3 +1,3 @@ module EmergeCLI - VERSION = '0.7.2'.freeze + VERSION = '0.7.3'.freeze end