From 3a3a31a3dc9d6e1d2cee3ca278d00c373a5f1ed8 Mon Sep 17 00:00:00 2001 From: Steve Randy Tantra Date: Mon, 2 May 2011 01:55:54 +0800 Subject: [PATCH] get_md5 should return @server_md5 when putting file in safe mode. --- lib/mongo/gridfs/grid_io.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/mongo/gridfs/grid_io.rb b/lib/mongo/gridfs/grid_io.rb index 87cb178..d4a3904 100644 --- a/lib/mongo/gridfs/grid_io.rb +++ b/lib/mongo/gridfs/grid_io.rb @@ -454,7 +454,9 @@ module Mongo @server_md5 = @files.db.command(md5_command)['md5'] if @safe @client_md5 = @local_md5.hexdigest - if @local_md5 != @server_md5 + if @local_md5 == @server_md5 + @server_md5 + else raise GridMD5Failure, "File on server failed MD5 check" end else