Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/commands/upload/snapshots/snapshots.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module EmergeCLI
VERSION = '0.7.2'.freeze
VERSION = '0.7.3'.freeze
end