mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 00:51:34 +02:00
copyurl: add no-clobber flag - fixes #3950
This commit is contained in:
@ -109,17 +109,30 @@ func TestRcCopyurl(t *testing.T) {
|
||||
"remote": "file1",
|
||||
"url": ts.URL,
|
||||
"autoFilename": false,
|
||||
"noClobber": false,
|
||||
}
|
||||
out, err := call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, rc.Params(nil), out)
|
||||
|
||||
in = rc.Params{
|
||||
"fs": r.FremoteName,
|
||||
"remote": "file1",
|
||||
"url": ts.URL,
|
||||
"autoFilename": false,
|
||||
"noClobber": true,
|
||||
}
|
||||
out, err = call.Fn(context.Background(), in)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, rc.Params(nil), out)
|
||||
|
||||
urlFileName := "filename.txt"
|
||||
in = rc.Params{
|
||||
"fs": r.FremoteName,
|
||||
"remote": "",
|
||||
"url": ts.URL + "/" + urlFileName,
|
||||
"autoFilename": true,
|
||||
"noClobber": false,
|
||||
}
|
||||
out, err = call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
@ -130,6 +143,7 @@ func TestRcCopyurl(t *testing.T) {
|
||||
"remote": "",
|
||||
"url": ts.URL,
|
||||
"autoFilename": true,
|
||||
"noClobber": false,
|
||||
}
|
||||
out, err = call.Fn(context.Background(), in)
|
||||
require.Error(t, err)
|
||||
|
Reference in New Issue
Block a user