Browse Source

Return attachment id in api response to attachment upload (#23566).

Patch by Jan Schulz-Hofen.

git-svn-id: http://svn.redmine.org/redmine/trunk@15762 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/3.4.0
Jean-Philippe Lang 7 years ago
parent
commit
baaa15ebdd

+ 1
- 0
app/views/attachments/upload.api.rsb View File

@@ -1,3 +1,4 @@
api.upload do
api.id @attachment.id
api.token @attachment.token
end

+ 3
- 0
test/integration/api_test/attachments_test.rb View File

@@ -111,9 +111,12 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base
assert_kind_of Hash, xml['upload']
token = xml['upload']['token']
assert_not_nil token
attachment_id = xml['upload']['id']
assert_not_nil attachment_id

attachment = Attachment.order('id DESC').first
assert_equal token, attachment.token
assert_equal attachment_id, attachment.id.to_s
assert_nil attachment.container
assert_equal 2, attachment.author_id
assert_equal 'File content'.size, attachment.filesize

Loading…
Cancel
Save