- locators = []
- size = 0
- manifest.each_line do |line|
- line.split(' ').each do |word|
- if match = LOCATOR_REGEXP.match(word)
- if match.size == 6 and match[5]
- size_str = match[5].split('+')[0]
- if size_str.to_i.to_s == size_str
- word = match[3] + '+' + size_str # get rid of any other hints
- size += size_str.to_i
- else
- word = match[3]
- end
- else
- word = match[3]
- end
- locators << word
- end
- end
+ locators = []
+ size = 0
+ manifest.scan(/(^|[^[:xdigit:]])([[:xdigit:]]{32})((\+\d+)(\+|\b))?/) do |_, hash, _, sizehint, _|
+ if sizehint
+ locators << hash.downcase + sizehint
+ size += sizehint.to_i
+ else
+ locators << hash.downcase