Copyfile always fails with "malformatted" path on DropBox

What is the problem you are having with rclone?

Calling copyfile with remote control api alwaays fails with "malformatted" path error. The exact same inputs with a different protocol ( Google Drive, OneDrive ) suceeds.

Run the command 'rclone version' and share the full output of the command.

rclone v1.63.1

  • os/version: Microsoft Windows 10 Enterprise 22H2 (64 bit)
  • os/kernel: 10.0.19045.3324 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.20.6
  • go/linking: static
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

DropBox

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Note: The following is PowerShell code but I can also reproduce the same with C++ code.

$headers=@{}
$headers.Add("user-agent", "vscode-restclient")
$headers.Add("content-type", "application/json")
$body='{ "srcFs" : "DropBox:",   "srcRemote" : "/NewTestDir/TestFolder/1.txt", "dstFs" : "C:/", "dstRemote" : "/Data/DeleteMe/DropBoxTest/1.txt" }'
Invoke-WebRequest -Uri 'http://127.0.0.1:5572/operations/copyfile' -Method POST -Headers $headers -ContentType 'application/json' -Body $body -UseBasicParsing

In comparison running the same command but against Google Drive works:

$headers=@{}
$headers.Add("user-agent", "vscode-restclient")
$headers.Add("content-type", "application/json")
$body='{ "srcFs" : "GDrveTest:", "srcRemote" : "/NewTestDir/TestFolder/1.txt", "dstFs" : "C:/", "dstRemote" : "/Data/DeleteMe/DropBoxTest/1.txt" }'
Invoke-WebRequest -Uri 'http://127.0.0.1:5572/operations/copyfile' -Method POST -Headers $headers -ContentType 'application/json' -Body $body -UseBasicParsing

The rclone config contents with secrets removed.

[DropBox]
type = dropbox
auth_url = 
timeout = 1m
token = {"access_token":"sl.BkVNZ7-cjjp1S-2I5u_0m8FE7BNLSpGg3YTAnqep6Y0bL8Z2kgm3cDXppAN6WxJgRa4nbl4plnKbNXHcC5kxEYL5NtT3cBo4NQze-_Vb0Ous7btZk6g0s3RicTopSwtLq5o-mQgJh1vLHjw","token_type":"bearer","refresh_token":"MxpL9yofm18AAAAAAAAAAVwer2FclHqCrPXhJppNv-3nROCqL56hLA99qIKYbgn-","expiry":"2023-08-18T13:51:39.7183096-04:00"}

[GDrveTest]
type = drive
auth_url = 
timeout = 1m
token = {"access_token":"ya29.a0AfB_byAbPqN0Sjk8H_RiI2sMbegoM6gp49QD4iF5XT3kVeqbdetP80-drJ_82cG4eYgvAbfFOIKxw7lPyMEQJ-I1SNGjQsNtC4wot4R4tQoUn5xiZe6TdhQCzi71_FLGaOKXi3GdwFavBAzGrhtSm4lTer8vaCgYKAWoSARMSFQHsvYlsHDh3BG-A45ml7sRcvsRH2w0163","token_type":"Bearer","refresh_token":"1//01FkYikPhH04lCgYIARAAGAESNwF-L9IrfX5KqtuYETLUZoBSMFYyD9s24RrcqxdrtWltBRq7dS6DdyvnnraDyrnN0UM7GJQmY1I","expiry":"2023-08-18T11:37:10.4765999-04:00"}
team_drive = 

A log from the command with the -vv flag

023/08/18 13:45:21 NOTICE: Serving remote control on http://127.0.0.1:5572/
2023/08/18 13:45:25 ERROR : rc: "operations/copyfile": error: path/malformed_path/
2023/08/18 13:46:14 ERROR : rc: "operations/copyfile": error: path/malformed_path/
2023/08/18 13:46:56 ERROR : rc: "operations/copyfile": error: path/malformed_path/..

Dropbox is a bit unique with the / in the items.

With the / is looks at the root and without, it's the user setup.

Can you try without rc and does it do the same thing on a command line or just RC is acting different?

You can see from testing

rclone lsf DropBox:
rclone lsf DropBox:/

@Animosity022

Sure enough, removing the root "/" from the remote path in the copyfile rcd API call allows it to work.

In contrast, calling regular copy on the command line with the root "/" in place works without issue.
rclone.exe copy DropBox:/NewTestDir/TestFolder/1.txt C:/Data/DeletMe/DropBoxTest/1.txt

So this looks to me like an issue specific to the copyfile rcd API call.

If it's what it looks like, then, I would think the solution that allows the regular command line copy command to process the path with the leading "/" needs to also be applied to the copyfile rcd API call.

@Animosity022
Also, to answer your question about lsf, it too handles the "rclone lsf DropBox:/" without issue.

The / and without are 2 different things on Dropbox as it doesn't matter if it's RCD or not.

Without the /, it's the user running the command.
With the /, it's the root of the whole account.

Interesting...

So as I was testing I can transfer files in any subdirectory by not having the leading "/"
ex.) DropBox:subfolder/test.txt ---> Works!

But I can't transfer files on the root in any case
ex.) DropBox:/test.txt ---> fails
ex.) DropBox:test.txt ---> fails

The other functionality like uploading/downloading, creating and renaming folders, works for these user's root path.

@Animosity022
Based on what you are saying how would one be able to format a path to transfer files to the user's "root" folder and not get it confused with the "root of the whole account" ?

If you can't transfer to the root, I'd imagine you are a personal account or don't have permissions to the whole thing.

I've never put a / in front as I always use my own account. If that's your goal, just remove the /

@Animosity022
Thank for your patience and helping with this.
This is new to me, so I am slowly starting to understand.

So you are saying paths without "/" it tells DropBox it is the user running the command ( I assume it then knows to resolve the path relative to a "user space"? )
And paths with "/" resolve to the root of a whole account. If the user has access there it will work, if not, then not.
In the DropBox Browser Dashboard I can upload/download files to what "looks" like the root folder and it succeeds ( maybe that is the user's area "root" and not the whole account root?)
Rclone's command line I can do the same using "copy".

In my case I believe I have a personal account. I created it with a dummy gmail account and I am on the free-basic plan. I didn't do any further configuration.

My thinking is that I just need to know what to give copyfile so it will resolve the path to whatever the location is, that looks like the root in DropBox Browser Dashboard

So I am thinking:
1.) How can I confirm what the location is of what looks like the "root" in the DropBox Browser Dashboard?
2.) How can I confirm I have access to it? ( Or not! )
3.) For the copyfile API call, what does it need so that the path "DropBox:/test.txt" or "DropBox:test.txt" can be resolved to that location?

Any suggestions?

I have a business account so I'm really not sure exactly how a personal account works.

Remove the /

rclone copy somefile.txt Dropbox:

Validate in the console it copied as it should and that's really it.

Remove the / as I said and just don't use it. No reason to make this overly complex.

Those two command should show you exactly what rclone sees.

image

Top is my user's.
Bottom is my whole business plan if you will as I only have 1 user.

I never use / in anything to start and never have in any rclone setup.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.