From 2339172df2ee82cb65df5bc9ba837ab5cf65ea29 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 18 Jan 2022 11:24:13 +0000 Subject: [PATCH] pcloud: fix pre-1970 time stamps - fixes #5917 Before this change rclone send pre-1970 timestamps as negative numbers. pCloud ignores these and sets them as todays date. This change sends the timestamps as unsigned 64 bit integers (which is how the binary protocol sends them) and pCloud accepts the (actually negative) timestamp like this. --- backend/pcloud/pcloud.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/pcloud/pcloud.go b/backend/pcloud/pcloud.go index 25a7c38e0..beab72b0e 100644 --- a/backend/pcloud/pcloud.go +++ b/backend/pcloud/pcloud.go @@ -690,7 +690,7 @@ func (f *Fs) Copy(ctx context.Context, src fs.Object, remote string) (fs.Object, opts.Parameters.Set("fileid", fileIDtoNumber(srcObj.id)) opts.Parameters.Set("toname", f.opt.Enc.FromStandardName(leaf)) opts.Parameters.Set("tofolderid", dirIDtoNumber(directoryID)) - opts.Parameters.Set("mtime", fmt.Sprintf("%d", srcObj.modTime.Unix())) + opts.Parameters.Set("mtime", fmt.Sprintf("%d", uint64(srcObj.modTime.Unix()))) var resp *http.Response var result api.ItemResult err = f.pacer.Call(func() (bool, error) { @@ -1171,7 +1171,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op opts.Parameters.Set("filename", leaf) opts.Parameters.Set("folderid", dirIDtoNumber(directoryID)) opts.Parameters.Set("nopartial", "1") - opts.Parameters.Set("mtime", fmt.Sprintf("%d", modTime.Unix())) + opts.Parameters.Set("mtime", fmt.Sprintf("%d", uint64(modTime.Unix()))) // Special treatment for a 0 length upload. This doesn't work // with PUT even with Content-Length set (by setting