卷曲更改multipart / form-data路径参数

时间:2019-03-07 12:16:33

标签: shell curl msys synology

我尝试在msys shell中使用curl将一些多部分/表单数据发送到名为Synology的NAS。表单数据需要一个名为“ path”的参数,并且格式必须类似于“ / dir / dir2”。斜线不能更改。
我的问题是,当我使用curl时,路径变量将更改为“ C:/ git-sdk-64 / dir / dir2”,但我不知道如何防止它。我的命令如下所示:

curl -X POST \
  'http://url:port/webapi/entry.cgi?_sid=secret&api=SYNO.FileStation.Upload&method=upload&version=2' \
  -F "path=/dir/dir2" \
  -F 'overwrite=true' \
  -F 'filename=@/c/Temp/test.txt'

1 个答案:

答案 0 :(得分:0)

由于Daniel Stenberg's的信息,我发现这是msys self的“问题”。 Msys填充路径变量。在http://www.mingw.org/wiki/Posix_path_conversion这里写下。解决方案是在路径的末尾添加分号。现在,完整的命令应如下所示:

curl -X POST \
  'http://url:port/webapi/entry.cgi?_sid=secret&api=SYNO.FileStation.Upload&method=upload&version=2' \
  -F "path=/dir/dir2;" \
  -F 'overwrite=true' \
  -F 'filename=@/c/Temp/test.txt'
相关问题