Skip to content

Commit 227b3d6

Browse files
hsbtclaude
andcommitted
Limit compact index dependency parser to split on first colon
The upcoming compact index v2 format introduced by rubygems.org appends a `created_at:ISO8601` field to each info line, and the timestamp's internal colons were being treated as additional split delimiters. Splitting only on the first colon keeps existing keys like `ruby:>= 2.7.0` intact while letting multi-colon values pass through untouched. rubygems/rubygems.org#6504 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent dce4b75 commit 227b3d6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lib/rubygems/resolver/api_set/gem_parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def parse(line)
1313
private
1414

1515
def parse_dependency(string)
16-
dependency = string.split(":")
16+
dependency = string.split(":", 2)
1717
dependency[-1] = dependency[-1].split("&") if dependency.size > 1
1818
dependency[0] = -dependency[0]
1919
dependency

spec/bundler/compact_index_client/parser_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def set_info_data(name, value)
4747
INFO
4848
let(:c_info) { <<~INFO }
4949
3.0.0 a:= 1.0.0,b:~> 2.0|checksum:ccc1,ruby:>= 2.7.0,rubygems:>= 3.0.0
50-
3.3.3 a:>= 1.1.0,b:~> 2.0|checksum:ccc3,ruby:>= 3.0.0,rubygems:>= 3.2.3
50+
3.3.3 a:>= 1.1.0,b:~> 2.0|checksum:ccc3,ruby:>= 3.0.0,rubygems:>= 3.2.3,created_at:2026-05-12T10:00:00Z
5151
INFO
5252

5353
describe "#available?" do
@@ -195,7 +195,7 @@ def set_info_data(name, value)
195195
"3.3.3",
196196
nil,
197197
[["a", [">= 1.1.0"]], ["b", ["~> 2.0"]]],
198-
[["checksum", ["ccc3"]], ["ruby", [">= 3.0.0"]], ["rubygems", [">= 3.2.3"]]],
198+
[["checksum", ["ccc3"]], ["ruby", [">= 3.0.0"]], ["rubygems", [">= 3.2.3"]], ["created_at", ["2026-05-12T10:00:00Z"]]],
199199
],
200200
]
201201
end

0 commit comments

Comments
 (0)