Skip to content

skip symlinks with non existing targets #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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