Feature #14830

REST API : Add support for attaching file to Wiki pages

Added by Michael Medin about 4 years ago. Updated 5 months ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:REST API
Target version:3.3.0
Resolution:Fixed

Description

Currently (2.3.2) it is not possible (that I know of) to attach files to wiki pages.
AS a workaround i have attached all files to an arbitrary ticket instead which works but is pretty awkward.

It would be nice if it was possible to attach the file directly to the wikipage instead.

// Michael Medin

add_rest_api_for_attaching_file_to_WIKI_page_trunk_r15317.patch Magnifier (3.07 KB) Takenori TAKAKI, 2016-04-11 09:02


Related issues

Related to Redmine - Patch #21066: Enable adding attachments to wiki entries using the Rest-API Closed
Duplicated by Redmine - Feature #13843: Redmine API: can wiki pages contain uploads Closed

Associated revisions

Revision 15415
Added by Jean-Philippe Lang over 1 year ago

Add support for attaching file to WIKI pages by REST API (#14830).

Patch by Takenori TAKAKI.

History

#1 Updated by Thomas Godard about 4 years ago

It is possible to attach files to Wiki pages ... See : http://www.redmine.org/projects/redmine/wiki/RedmineProjects for example

#2 Updated by Michael Medin about 4 years ago

Sorry, I forgot to mention I meant via the REST API.

#3 Updated by Toshi MARUYAMA about 4 years ago

  • Subject changed from Add support for attaching file to WIKI pages to Add support for attaching file to WIKI pages by REST API
  • Category changed from Rails support to REST API

#4 Updated by Sven S. about 2 years ago

Had the same problem here, the following patch make it working (I am not a ruby specialist, just took the snippet from the issue controller; normal upload and rest upload is then working):

Index: wiki_controller.rb
===================================================================
--- wiki_controller.rb    (revision 14728)
+++ wiki_controller.rb    (working copy)
@@ -152,7 +152,7 @@
     @content.author = User.current

     if @page.save_with_content(@content)
-      attachments = Attachment.attach_files(@page, params[:attachments])
+      attachments = Attachment.attach_files(@page, params[:attachments] || (params[:wiki_page] && params[:wiki_page][:uploads]))
       render_attachment_warning_if_needed(@page)
       call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})

Added this patch to the patch-queue #21066

#5 Updated by Toshi MARUYAMA about 2 years ago

  • Related to Patch #21066: Enable adding attachments to wiki entries using the Rest-API added

#6 Updated by Go MAEDA almost 2 years ago

  • Duplicated by Feature #13843: Redmine API: can wiki pages contain uploads added

#7 Updated by Takenori TAKAKI over 1 year ago

I added a test-case for Sven S.'s patch.
This patch workes fine under the latest trunk r15317.
I would be happy if I could see the feature in Redmine 3.3.0.

#8 Updated by Toshi MARUYAMA over 1 year ago

  • Target version set to 3.3.0

#9 Updated by Jean-Philippe Lang over 1 year ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Committed, thanks. I've removed the test with the 'attachment' param as it's not supposed to be used with the API. Attachments should be added through the API with wiki_page[uploads].

#10 Updated by Jean-Philippe Lang over 1 year ago

  • Subject changed from Add support for attaching file to WIKI pages by REST API to REST API : Add support for attaching file to Wiki pages

#11 Updated by Vu Anh 6 months ago

Michael Medin wrote:

Currently (2.3.2) it is not possible (that I know of) to attach files to wiki pages.
AS a workaround i have attached all files to an arbitrary ticket instead which works but is pretty awkward.

It would be nice if it was possible to attach the file directly to the wikipage instead.

// Michael Medin

I'm realy not clear about this feature.@Michael, Lang Can you explain more about it. How can i replay it ? I'm using v.3.2.6

#12 Updated by Toshi MARUYAMA 5 months ago

Vu Anh wrote:

Michael Medin wrote:

Currently (2.3.2) it is not possible (that I know of) to attach files to wiki pages.
AS a workaround i have attached all files to an arbitrary ticket instead which works but is pretty awkward.

It would be nice if it was possible to attach the file directly to the wikipage instead.

// Michael Medin

I'm realy not clear about this feature.@Michael, Lang Can you explain more about it. How can i replay it ? I'm using v.3.2.6

This feature is included in Redmine 3.3.

Also available in: Atom PDF