通过 webDAV API 在 nextcloud 中移动文件失败

问题描述 投票:0回答:0

我正在尝试从 Linux 命令行运行 CURL 命令,根据本手册,该命令应该将文件移动到不同的文件夹:https://docs.nextcloud.com/server/latest/developer_manual/client_apis/ WebDAV/basic.html#copying-files-and-folders-rfc4918

首先我创建了文件夹:

curl 'https://example.com/remote.php/dav/files/user/recording/2023/02/18' --user 'user:password' --request MKCOL

这个效果很好。

然后我尝试将文件移动到此文件夹:

curl 'https://example.com/remote.php/dav/files/user/recording/2023-02-18 18-24-52.mp4' --user 'user:password' --request MOVE -H 'Destination:https://example.com/remote.php/dav/files/user/recording/2023/02/18/'

但是,我收到了 400 错误,提示“您的浏览器发送了该服务器无法理解的请求。”。我在命令中尝试了几种不同的序列(不确定是否重要)、短(-X)和长(--request)标志,并将最后一个 / 放在目标目录上,但我无法弄清楚。

我在调试模式下检查了日志文件,但是当 MKCOL 调用在那里留下了痕迹时,根本没有关于 MOVE 请求的日志文件内容。

curl webdav nextcloud
© www.soinside.com 2019 - 2024. All rights reserved.