プロジェクト

全般

プロフィール

Vote #81794

完了

WikiContentVersion API returns 500 if author is nil

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

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

0%

予定工数:
category_id:
1
version_id:
171
issue_org_id:
36494
author_id:
572130
assigned_to_id:
107353
comments:
19
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
170
ステータス-->[Closed]

説明

Redmine instance. redmine.replicant.us

Redmine returns error 500 on the DeprecatedWikiStart at revision 1:
https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/1.json

While it works at revision 2:
https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/2.json

bugreport in Redmine.

If we look at the history, the revision 1 doesn't have any author:
https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/history?page=10&per_page=25

If we look at the content of the page, redmine reports @Anonymous@ as author:
https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/1

And the page content looks like content automatically generated by Trac (we first used Trac and then OSUOSL kindly migrated us to Redmine which was easier to maintain).

Now, after recent update, that we have the latest Redmine version, the problem still presists so that is why we openned this bugreport here:

Environment:
Redmine version 4.2.3.stable
Ruby version 2.7.5-p203 (2021-11-24) [x86_64-linux]
Rails version 5.2.6
Environment production
[...]

journals

Could you paste the error log in production.log (it should be created under /path/to/redmine/log directory) in your Redmine server?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
server administrators have been contacted, I should get back to you in a couple days
--------------------------------------------------------------------------------
Hey there ounce again, sorry for the delayed response but Denis was quite busy with RE (Reverse engineering) modem work. So yesterday we (replicant project) were finally able to take care of this.
Go MAEDA and Marius BALTEANU here you go:
"Denis,

Here's the error message from the container logs:

<pre>
I, [2022-01-31T22:17:24.845018 #1] INFO -- : Started GET
"/projects/replicant/wiki/DeprecatedWikiStart/1.json" for <IP> at
2022-01-31 22:17:24 +0000
I, [2022-01-31T22:17:24.847246 #1] INFO -- : Processing by
WikiController#show as JSON
I, [2022-01-31T22:17:24.847330 #1] INFO -- : Parameters:
{"project_id"=>"replicant", "id"=>"DeprecatedWikiStart", "version"=>"1"}
I, [2022-01-31T22:17:24.853893 #1] INFO -- : Current user: anonymous
I, [2022-01-31T22:17:24.885501 #1] INFO -- : Rendering wiki/show.api.rsb
I, [2022-01-31T22:17:24.901433 #1] INFO -- : Rendered wiki/show.api.rsb
(15.8ms)
I, [2022-01-31T22:17:24.901998 #1] INFO -- : Completed 500 Internal
Server Error in 54ms (ActiveRecord: 12.0ms)
F, [2022-01-31T22:17:24.903798 #1] FATAL -- :
F, [2022-01-31T22:17:24.903876 #1] FATAL -- :
ActionView::Template::Error (undefined method `name' for nil:NilClass):
F, [2022-01-31T22:17:24.904123 #1] FATAL -- : 5: end
6: api.text @content.text
7: api.version @content.version
8: api.author(:id => @content.author_id, :name => @content.author.name)
9: api.comments @content.comments
10: api.created_on @page.created_on
11: api.updated_on @content.updated_on
F, [2022-01-31T22:17:24.904177 #1] FATAL -- :
F, [2022-01-31T22:17:24.904222 #1] FATAL -- :
app/views/wiki/show.api.rsb:8:in `block (2 levels) in
_app_views_wiki_show_api_rsb__1814568556711033433_11882640'
lib/redmine/views/builders/structure.rb:73:in `method_missing'
app/views/wiki/show.api.rsb:1:in `block in
_app_views_wiki_show_api_rsb__1814568556711033433_11882640'
lib/redmine/views/builders.rb:36:in `for'
app/views/wiki/show.api.rsb:1:in
`_app_views_wiki_show_api_rsb__1814568556711033433_11882640'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'
</pre>
"
Cheers Irelativism
--------------------------------------------------------------------------------
Please change status to "in progress" and maybe asignee GoMAEDA to this issue :). Cheers
--------------------------------------------------------------------------------
Can you post, please, the entire information details from the admin page? I'm interested in the Redmine plugins section as well.
--------------------------------------------------------------------------------
I did now a quick test:
* Logged with jsmith
* Created a WikiPage
* Created two revisions
* Switch to admin
* Deleted user jsmith
* Open the history of the page
* Both revisions are correctly displayed with Anonymous:
!revisions.png!
--------------------------------------------------------------------------------
Indeed, this line of code (source:/trunk/app/views/wiki/show.api.rsb#L8) doesn't check if author exists, maybe we should add an extra check. Anyway, in your case, I think the best option is to update that entry in the database and set the @User.anonymous.id@ as author_id@.
--------------------------------------------------------------------------------
I think in our case this is more regarding the migration before we used redmine, so the migration from trac more specifically, given there were sone anonymous contriburions that were transfered into redmine, but maybe not you never know I dont n
--------------------------------------------------------------------------------
. ¦3<RELATIVISM . wrote:
> I think in our case this is more regarding the migration before we used redmine, so the migration from trac more specifically, given there were sone anonymous contriburions that were transfered into redmine, but maybe not you never know I dont n

Yes, most probably. I think we can close this.
--------------------------------------------------------------------------------
What!!?! Its obviously quite easy to reproduce this issue just go to https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/1.json, please dont close this issue!! that is a huge disrespect for the time me and GNUtoo spent reporting it, when we could be doing many other usefull stuff for our own projects :s;S. Just because we migrated from Trac doesnt mean this is a problem on our side, it is still a bug with redmine. But its all explained already in description of this report :)
--------------------------------------------------------------------------------
. ¦3<RELATIVISM . wrote:
> What!!?! Its obviously quite easy to reproduce this issue just go to https://redmine.replicant.us/projects/replicant/wiki/DeprecatedWikiStart/1.json, please dont close this issue!! that is a huge disrespect for the time me and GNUtoo spent reporting it, when we could be doing many other usefull stuff for our own projects :s;S. Just because we migrated from Trac doesnt mean this is a problem on our side, it is still a bug with redmine. But its all explained already in description of this report :)

I was able to reproduce on your instance, but not on a fresh install. As I said in #note-8, it is an inconsistency in your database.

I checked now the table definition and according to the schema, @author_id@ can be null so we will add the extra check in the code.

<pre>
redmine_development-# \d wiki_contents;
id | integer | | not null | nextval('wiki_contents_id_seq'::regclass)
page_id | integer | | not null |
author_id | integer | | |
text | text | | |
comments | character varying(1024) | | | ''::character varying
updated_on | timestamp without time zone | | not null |
version | integer | | not null |
</pre>
--------------------------------------------------------------------------------

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

--------------------------------------------------------------------------------
thanks for reopening issue, I was able to reproduce on redmine.org. So it might not just be a problem with just our instance
--------------------------------------------------------------------------------
here is related error message when running testing scripts:
"
Redmine-page-version: 1" --cleanup=verbatim
Traceback (most recent call last):
File "./testredmine.py", line 306, in <module>
main()
File "./testredmine.py", line 291, in main
git_commit(extension, output_directory, page, file_paths, redmine_instance)
File "./testredmine.py", line 172, in git_commit
sh.git('-C', output_directory, 'commit', *command_args)
File "/usr/lib/python3/dist-packages/sh.py", line 1427, in __call__
return RunningCommand(cmd, call_args, stdin, stdout, stderr)
File "/usr/lib/python3/dist-packages/sh.py", line 774, in __init__
self.wait()
File "/usr/lib/python3/dist-packages/sh.py", line 792, in wait
self.handle_command_exit_code(exit_code)
File "/usr/lib/python3/dist-packages/sh.py", line 815, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
"
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I've added an extra check for now as we already have in views. Maybe it's better to add also a migration to make the @author_id@ field not null, but we should do it in a later version.
--------------------------------------------------------------------------------

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

Admin Redmine さんが3年以上前に更新

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

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

いいね!0
いいね!0