diff --git a/NEWS b/NEWS index ed02f573f..a3420112d 100644 --- a/NEWS +++ b/NEWS @@ -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). diff --git a/src/FileCopy.cc b/src/FileCopy.cc index b1491da15..ead65a2e0 100644 --- a/src/FileCopy.cc +++ b/src/FileCopy.cc @@ -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 diff --git a/src/FileCopy.h b/src/FileCopy.h index e5e950245..af978809b 100644 --- a/src/FileCopy.h +++ b/src/FileCopy.h @@ -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; }; @@ -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