X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/56d8ed80ce834a051be71d2bcf76a346b7bc7f0b..926625e0650d6e055ee098798694af3006ae34a9:/services/api/app/models/collection.rb diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb index 99510449fe..03e5e4ef44 100644 --- a/services/api/app/models/collection.rb +++ b/services/api/app/models/collection.rb @@ -28,7 +28,9 @@ class Collection < ArvadosModel if self.manifest_text.nil? and self.uuid.nil? super elsif self.manifest_text and self.uuid - if self.uuid.gsub(/\+[^,]+/,'') == Digest::MD5.hexdigest(self.manifest_text) + self.uuid.gsub! /\+.*/, '' + if self.uuid == Digest::MD5.hexdigest(self.manifest_text) + self.uuid.gsub! /$/, '+' + self.manifest_text.length.to_s true else errors.add :uuid, 'uuid does not match checksum of manifest_text' @@ -63,6 +65,14 @@ class Collection < ArvadosModel @files = [] manifest_text.split("\n").each do |stream| toks = stream.split(" ") + + stream = toks[0].gsub /\\(\\|[0-7]{3})/ do |escape_sequence| + case $1 + when '\\' '\\' + else $1.to_i(8).chr + end + end + toks[1..-1].each do |tok| if (re = tok.match /^[0-9a-f]{32}/) blocksize = nil @@ -84,7 +94,7 @@ class Collection < ArvadosModel else $1.to_i(8).chr end end - @files << [toks[0], filename, re[2].to_i] + @files << [stream, filename, re[2].to_i] end end end