プロジェクト

全般

プロフィール

Vote #76882

完了

Deleting invalid wiki page version deletes whole page content

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

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

0%

予定工数:
category_id:
1
version_id:
105
issue_org_id:
21155
author_id:
103744
assigned_to_id:
1
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
103
ステータス-->[Closed]

説明

Hello.
We just found bug in redmine 3.1.1.
We was need to remove version of the redmine wiki, but we dropped whole wiki page (content).
How it was:

  • user opened "/projects/some our project/wiki/Some_Name_Of_Wiki_Page/history" in two different tabs
  • For example he has 29 versions. And he was need to delete the 29th version.
  • he clicked delete link on first tab for the 29 version
  • ok, was deleted.
  • but user went to the second tab and clicked delete link for the 29th version again
  • whole wiki was removed, but there was 28 versions. And error 500 "undefined method versions' for nil:NilClass" <pre> Some piece of log …redmine/redmine-3.1/app/controllers/wiki_controller.rb: 210:inhistory' …k-4.2.4/lib/action_controller/metal/implicit_render.rb: 4:in send_action' …/gems/actionpack-4.2.4/lib/abstract_controller/base.rb: 198:inprocess_action' …ionpack-4.2.4/lib/action_controller/metal/rendering.rb: 10:in process_action' …/actionpack-4.2.4/lib/abstract_controller/callbacks.rb: 20:inblock in process_action'

Why it was:

wiki_controller.rb -> destroy_version

There is 2 lines

@content = @page.content_for_version(params[:version])
@content.destroy

Method of instance WikiPage (@page is) "content_for_version" did not found version (right, it was deleted) and return instance WikiContent instead (variable content - its assotoation to WikiContent by page_id column). And there is dropped the WikiContent instance in the second line in the controller.

def content_for_version(version=nil)
  if content
    result = content.versions.find_by_version(version.to_i) if version
    result ||= content
    result
  end
end

What will be best:

  • check wiki version existing and return 404 (render_404) OR
  • just move back to refreshed history page

Of cource, user has a lot of pages opened and he mistaked, when he deleted one version twice. But system can catch same misses.

And, by SubmittingBugs instruction:
Database manager version: MySQL 5.5.46 (MariaDB)
Ruby version: 2.2.1
Rails version: 4.2.4
Redmine version: 3.1.1
Plugins: for check bug we made clear redmine on new server, so, no any plugins.


journals

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

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

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

--------------------------------------------------------------------------------
Thanks for reporting this. Redmine now responds with 404 in this case.
--------------------------------------------------------------------------------

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

  • カテゴリWiki_1 にセット
  • 対象バージョン2.6.8_105 にセット

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

いいね!0
いいね!0