Skip to content

Commit

Permalink
get/mget: fixed -O option with remote URL and xfer:use-temp-file bein…
Browse files Browse the repository at this point in the history
…g true (fix #577)
  • Loading branch information
lavv17 committed Jun 4, 2020
1 parent 7f8d6c0 commit 8f9719b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
* mkdir: fixed exit code with -f option.
* ftp: made ftp:use-pret setting tri-boolean.
* get/mget/put/mput: don't try next files after error if cmd:fail-exit is true.
* get/mget: fixed -O option with remote URL and xfer:use-temp-file being true.
* mirror: disallow empty patterns; don't delete "..".
* mirror: fixed --on-change with --reverse.
* sftp: fixed a bug with truncated files when packets are reordered (finally).
Expand Down
8 changes: 8 additions & 0 deletions src/FileCopy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,14 @@ FileCopyPeer *FileCopyPeerFA::Clone()
return c;
}

const char *FileCopyPeerFA::UseTempFile(const char *file)
{
const char *temp=FileCopyPeer::UseTempFile(file);
if(temp!=file && orig_url)
dirname_modify(orig_url).append('/').append_url_encoded(basename_ptr(temp),URL_PATH_UNSAFE);
return temp;
}

// FileCopyPeerFDStream
#undef super
#define super FileCopyPeer
Expand Down
3 changes: 2 additions & 1 deletion src/FileCopy.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class FileCopyPeer : public IOBuffer
void SetSuggestedFileName(const char *f) { if(f) suggested_filename.set(f); }
void AutoRename(bool yes=true) { auto_rename=yes; }
bool IsAutoRename() const { return auto_rename; }
const char *UseTempFile(const char *);
virtual const char *UseTempFile(const char *);
bool ShouldRename() const;
};

Expand Down Expand Up @@ -380,6 +380,7 @@ class FileCopyPeerFA : public FileCopyPeer
return orig_url ? orig_url : session->GetFileURL(file);
}
FileCopyPeer *Clone();
const char *UseTempFile(const char *) override;
};

class FileCopyPeerFDStream : public FileCopyPeer
Expand Down

0 comments on commit 8f9719b

Please sign in to comment.