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
5 changes: 4 additions & 1 deletion bundler/lib/bundler/compact_index_client/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ def gem_parser
# This method gets called at least once for every gem when parsing versions.
def parse_version_checksum(line, checksums)
return unless (name_end = line.index(" ")) # Artifactory bug causes blank lines in artifactor index files
return unless (checksum_start = line.index(" ", name_end + 1) + 1)
checksum_start = line.index(" ", name_end + 1)
return unless checksum_start
checksum_start += 1

checksum_end = line.size - checksum_start

line.freeze # allows slicing into the string to not allocate a copy of the line
Expand Down
12 changes: 12 additions & 0 deletions spec/bundler/compact_index_client/parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,17 @@ def set_info_data(name, value)
VERSIONS
expect(parser.info("a")).to eq(a_result)
end

it "handles lines without a checksum" do
compact_index.versions = <<~VERSIONS
created_at: 2024-05-01T00:00:04Z
---
a 1.0.0,1.0.1,1.1.0 aaa111
b 2.0.0,2.0.0-java
c 3.0.0,3.0.3,3.3.3 ccc333
VERSIONS

expect(parser.info("a")).to eq(a_result)
end
end
end
Loading