diff options
-rw-r--r-- | lib/mogilefs/http_file.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/mogilefs/http_file.rb b/lib/mogilefs/http_file.rb index b8bfd48..1c8acd7 100644 --- a/lib/mogilefs/http_file.rb +++ b/lib/mogilefs/http_file.rb @@ -177,13 +177,18 @@ class MogileFS::HTTPFile < StringIO :size => bytes_uploaded, :path => uri.to_s, } - if @md5 - args[:checksum] = "MD5:#{@md5.hexdigest}" - elsif String === @opts[:content_md5] - hex = @opts[:content_md5].unpack('m')[0].unpack('H*')[0] - args[:checksum] = "MD5:#{hex}" + + # checksums are not yet supported in upstream MogileFS as of 2011-12-06 + if @opts[:MD5] + if @md5 + args[:checksum] = "MD5:#{@md5.hexdigest}" + elsif String === @opts[:content_md5] + hex = @opts[:content_md5].unpack('m')[0].unpack('H*')[0] + args[:checksum] = "MD5:#{hex}" + end + args[:checksumverify] = 1 if @opts[:checksumverify] end - args[:checksumverify] = 1 if @opts[:checksumverify] + @opts[:backend].create_close(args) bytes_uploaded end |