lib/capsaicin/files/remote.rb in capsaicin-0.1.6 vs lib/capsaicin/files/remote.rb in capsaicin-0.1.7

- old
+ new

@@ -60,11 +60,11 @@ case _via when :system, :local_run cp from, to else if _via.to_s[0,4] == 'sudo' - if to[-1]==?/ || to[-1]==?\ || directory?(to) + if to[-1]==?/ || to[-1]==?\\ || directory?(to) tof = File.basename from to2, to = "#{to}/#{tof}", "/tmp/#{tof}-#{Time.now.utc.to_i}" else tof = File.basename to to2, to = to, "/tmp/#{tof}-#{Time.now.utc.to_i}" @@ -92,12 +92,11 @@ case _via when :system, :local_run FileUtils::Verbose.copy_stream StringIO.new(from), to else if _via.to_s[0,4] == 'sudo' - if path[-1]==?/ || path[-1]==?\ || directory?(path) - pathf = File.basename from - path2, path = "#{path}/#{pathf}", "/tmp/#{pathf}-#{Time.now.utc.to_i}" + if path[-1]==?/ || path[-1]==?\\ || directory?(path) + abort "Target path is a directory!" else pathf = File.basename path path2, path = path, "/tmp/#{pathf}-#{Time.now.utc.to_i}" end end