minor: patch for JRuby 1.9 MD5 comparison bug
This commit is contained in:
parent
dd02b12282
commit
68cadc1987
|
@ -50,4 +50,9 @@ require 'mongo/exceptions'
|
||||||
require 'mongo/gridfs/grid_ext'
|
require 'mongo/gridfs/grid_ext'
|
||||||
require 'mongo/gridfs/grid'
|
require 'mongo/gridfs/grid'
|
||||||
require 'mongo/gridfs/grid_io'
|
require 'mongo/gridfs/grid_io'
|
||||||
|
if RUBY_PLATFORM =~ /java/
|
||||||
|
require 'mongo/gridfs/grid_io_fix'
|
||||||
|
end
|
||||||
require 'mongo/gridfs/grid_file_system'
|
require 'mongo/gridfs/grid_file_system'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
|
||||||
|
# --
|
||||||
|
# Copyright (C) 2008-2010 10gen Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
# ++
|
||||||
|
|
||||||
|
module Mongo
|
||||||
|
class GridIO
|
||||||
|
|
||||||
|
# This fixes a comparson issue in JRuby 1.9
|
||||||
|
def get_md5
|
||||||
|
md5_command = BSON::OrderedHash.new
|
||||||
|
md5_command['filemd5'] = @files_id
|
||||||
|
md5_command['root'] = @fs_name
|
||||||
|
@server_md5 = @files.db.command(md5_command)['md5']
|
||||||
|
if @safe
|
||||||
|
@client_md5 = @local_md5.hexdigest
|
||||||
|
if @local_md5.to_s != @server_md5.to_s
|
||||||
|
raise GridMD5Failure, "File on server failed MD5 check"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@server_md5
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue