【问题标题】:Redmine Rest API - file attachment, upload token is not completeRedmine Rest API - 文件附件,上传令牌不完整
【发布时间】:2019-10-25 20:28:30
【问题描述】:

我正在尝试添加文件附件的问题,但响应令牌不完整。

http://www.redmine.org/boards/2/topics/42425 (5 岁问题)相同的错误,但那里没有响应。

使用的 redmine 是 3.2.1.stable。

我正在使用https://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files 知道如何上传文件,但是当我对/uploads.json?filename=myFileName 执行POST 时,响应类似于{"upload":{"token":"6898."}} 响应代码仍然是201,所以它没有好像有错误。

对 API 调用的响应应该类似于 {"upload":{"token":"7167.ed1ccdb093229ca1bd0b043618d88743"}}

我尝试使用返回的部分令牌,但无济于事。 任何人都知道为什么令牌不正常/如何解决问题?

【问题讨论】:

    标签: redmine redmine-api


    【解决方案1】:

    由于某种原因,Redmine 无法将上传的文件复制到永久 (final) 位置。可能是磁盘空间不足,也可能是文件名有问题。检查您的环境.log 中的

    "Saving attachment '#{self.diskfile}' (#{@temp_file.size} bytes)"
    

    文件上传时。也许这会说明原因。

    【讨论】:

    • 我没有找到任何声明"Saving attachment"...Started POST "/uploads.json?filename=phpZRN9zu.jpg" for x.x.x.x at 2019-10-28 14:26:00 -0400 Processing by AttachmentsController#upload as JSON Parameters: {"filename"=>"phpZRN9zu.jpg"} Current user: api-site-web (id=56) Rendered attachments/upload.api.rsb (0.8ms) Completed 201 Created in 22ms (Views: 6.1ms | ActiveRecord: 8.0ms)
    【解决方案2】:

    其实问题是发送的文件是空的。

    这个答案很可能对某人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-25
      • 2014-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多