Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions lib/net/scp/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ def upload_start_state(channel)
end

channel[:chunk_size] = channel[:options][:chunk_size] || DEFAULT_CHUNK_SIZE
set_current(channel, channel[:local])
await_response(channel, :upload_current)
if set_current(channel, channel[:local])
await_response(channel, :upload_current)
else
next_item_state(channel)
end
end

# Determines what the next thing to upload is, and branches. If the next
Expand Down Expand Up @@ -100,8 +103,11 @@ def next_item_state(channel)
channel.send_data("E\n")
await_response(channel, channel[:stack].empty? ? :finish : :next_item)
else
set_current(channel, next_item)
upload_current_state(channel)
if set_current(channel, next_item)
upload_current_state(channel)
else
next_item_state(channel)
end
end
end
end
Expand All @@ -113,11 +119,14 @@ def set_current(channel, path)

if channel[:current].respond_to?(:read)
channel[:stat] = channel[:current].stat if channel[:current].respond_to?(:stat)
elsif File.symlink?(channel[:current])
return false
else
channel[:stat] = File.stat(channel[:current])
end

channel[:size] = channel[:stat] ? channel[:stat].size : channel[:current].size
return true
end

# If the :preserve option is set, send a 'T' directive and wait for the
Expand Down