Project

General

Profile

Actions

Defect #22193

closed

Getting 404 on Ajax update_form.js request when changing tracker of new issue

Added by Alexander Herr over 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I have a project with a custom tracker and user-defined fields for that tracker. When creating a new issue in that project that tracker isn't the default one (which is intended) but when trying to use it the user-defined field does not pop up. In the browser console it is revealed that a request to `host/projects/<project-id>/issues/update_form.js` is made but the webserver returns with a 404 Not Found.

Now the strange thing is that when I have created a new issue in that project and then edit it, I can change the tracker just fine and the user-defined field pops up! It is making the exact (!) same request only appended with the issue-id, i.e. `host/projects/<project-id>/issues/update_form.js?id=<issue-id>`. Both ajax calls are POST calls, and the included data is also exactly the same apart from the issue-id being set if the issue was already created.

I do not know how to debug this further. It does not seem to me that my Webserver (apache) is misconfigured as no redirecting or routing is happening there:

<VirtualHost *:80>
    RailsEnv production
    PassengerDefaultUser redmine
    Alias "/plugin_assets/" /var/cache/redmine/default/plugin_assets/
    DocumentRoot /var/www/redmine
    <Directory "/var/www/redmine/public">
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
    <Directory "/var/www/redmine/plugin_assets/">
        Allow from all
        Options -MultiViews
        Require all granted
    </Directory>
</VirtualHost>
Actions #1

Updated by Alexander Herr over 8 years ago

I've found that the XHR object passed to the ajax request is missing the issue[project_id] variable. That is why redmine cannot find the id in the find_project_from_issue before_filter, which by default returns a 404 HTTP code.

Actions #2

Updated by Alexander Herr over 8 years ago

I "fixed" this by adding

<p style="display:none;"><%= f.text_field :project_id, :value => @issue.project_id %></p>

to app/views/issues/_form.html.erb.

This renders an extra but hidden text field with the project's id to the form. When the ajax request is made, it can serialize the :project_id variable as intended and will then find the id in the before_filter.

This is still a bug and I doubt that my "fix" is the correct solution.

Actions #3

Updated by Vsevolod K over 8 years ago

I have the same problem with Redmine installed from Debian repository.
In Google cache I found this article:
http://webcache.googleusercontent.com/search?q=cache:USO1iZ8Q83sJ:sources.debian.net/patches/patch/redmine/3.0~20140825-8/fix-move-issue-between-projects.patch/+&cd=3&hl=ru&ct=clnk&gl=ua
I think, that find_project_from_issue before_filter is a patch from Debian team.
I change implementation of find_project_from_issue
from: project_id = (params[:issue] && params[:issue][:project_id])
to: project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
like in find_project before_filter, that is only one declared in issues_controller.rb in Redmine SVN ver 2.5
My problem has been "fixed", but I don't know whether other problems.

Actions #4

Updated by Toshi MARUYAMA over 8 years ago

  • Status changed from New to Needs feedback

See Submissions.
And Redmine 3.0 is not maintained.

Actions #5

Updated by Toshi MARUYAMA over 8 years ago

Vsevolod K wrote:

I have the same problem with Redmine installed from Debian repository.
In Google cache I found this article:
http://webcache.googleusercontent.com/search?q=cache:USO1iZ8Q83sJ:sources.debian.net/patches/patch/redmine/3.0~20140825-8/fix-move-issue-between-projects.patch/+&cd=3&hl=ru&ct=clnk&gl=ua
I think, that find_project_from_issue before_filter is a patch from Debian team.
I change implementation of find_project_from_issue
from: project_id = (params[:issue] && params[:issue][:project_id])
to: project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])
like in find_project before_filter, that is only one declared in issues_controller.rb in Redmine SVN ver 2.5
My problem has been "fixed", but I don't know whether other problems.

FTR:
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1317864.html

Actions #6

Updated by Philip Heise over 8 years ago

Hi,

I have the same problem with my Redmine installation from Debian.

Vsevolod K wrote:

I change implementation of find_project_from_issue
from: project_id = (params[:issue] && params[:issue][:project_id])
to: project_id = params[:project_id] || (params[:issue] && params[:issue][:project_id])

Did your report your issue/ fix to Debian?

Actions #7

Updated by Marcin Szewczyk over 7 years ago

Philip Heise wrote:

Did your report your issue/ fix to Debian?

I've just stumbled upon the bug and supplemented the Debian bug report. The email should appear shortly.

Actions #8

Updated by Toshi MARUYAMA over 7 years ago

  • Status changed from Needs feedback to Closed
  • Resolution set to Invalid

Close because it seems caused by package.

Actions

Also available in: Atom PDF