lib/ddr/models/with_content_file.rb in ddr-models-3.0.0.beta.7 vs lib/ddr/models/with_content_file.rb in ddr-models-3.0.0.beta.8
- old
+ new
@@ -11,24 +11,24 @@
# Yields path of tempfile containing content to block
# @yield [String] the path to the tempfile containing content
def with_temp_file
filename = original_filename || content.default_file_name
- basename = [ File.basename(filename, ".*"), File.extname(filename) ]
+ basename = [ ::File.basename(filename, ".*"), ::File.extname(filename) ]
infile = Tempfile.open(basename, Ddr::Models.tempdir, encoding: 'ascii-8bit')
begin
infile.write(content.content)
infile.close
verify_checksum!(infile)
yield infile.path
ensure
infile.close unless infile.closed?
- File.unlink(infile)
+ ::File.unlink(infile)
end
end
def verify_checksum!(file)
- digest = Ddr::Utils.digest(File.read(file), content.checksum.algorithm)
+ digest = Ddr::Utils.digest(::File.read(file), content.checksum.algorithm)
if digest != content.checksum.value
raise ChecksumInvalid, "The checksum of the downloaded file does not match the stored checksum of the content."
end
end