プロジェクト

全般

プロフィール

Vote #74347

完了

REST API : Add support for attaching file to Wiki pages

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
110
issue_org_id:
14830
author_id:
84973
assigned_to_id:
1
comments:
12
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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


journals

It is possible to attach files to Wiki pages ... See : http://www.redmine.org/projects/redmine/wiki/RedmineProjects for example
--------------------------------------------------------------------------------
Sorry, I forgot to mention I meant via the REST API.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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):

<pre><code class="diff">
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})
</code></pre>

Added this patch to the patch-queue #21066
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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].
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------


related_issues

relates,Closed,21066,Enable adding attachments to wiki entries using the Rest-API
duplicates,Closed,13843,Redmine API: can wiki pages contain uploads

Admin Redmine さんが約4年前に更新

  • カテゴリREST API_32 にセット
  • 対象バージョン3.3.0_110 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0