0

I'm trying to add an issue with a file attachment but the response token is not complete.

It is the same error as http://www.redmine.org/boards/2/topics/42425 (5 years old question) but there is no response there.

The redmine used is a 3.2.1.stable.

I'm using https://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files to know how to upload files, but when I do a POST to /uploads.json?filename=myFileName, the response is something like {"upload":{"token":"6898."}} The response code is still a 201, so it doesn't seem like there is an error.

The response to the API call should be something like {"upload":{"token":"7167.ed1ccdb093229ca1bd0b043618d88743"}}.

I tried using the partial token returned, to no avail. Anyone have an idea as to why the token is not okay / how to correct the problem?

2 Answers2

1

For some reason Redmine can't copy uploaded file to persistent (final) location. Maybe there's a lack of disk space, maybe there are some issues with file name. Check your environment.log for

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

when the file is being uploaded. Maybe this will indicate the reason.

Lyzard Kyng
  • 1,518
  • 1
  • 9
  • 14
  • I don't find any line stating `"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)``` – Amelie Turgeon Oct 28 '19 at 18:31
0

In fact, the problem was that the file sent was empty.

This answer may well be of help to someone.