View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0021994||mantisbt||attachments||public||2016-11-30 10:20||2017-06-04 14:58|
|Target Version||2.5.0||Fixed in Version||2.5.0|
|Summary||0021994: issue with attachments cannot be moved between projects with different upload directories (uploads saved in file system)|
I use file system based attachment uploads.
When attempting to move an issue with attachments between projects with different upload directories I see:
APPLICATION ERROR 0000401 Database query failed. Error received from database was 0001064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 for the query: UPDATE mantis_bug_file_table SET folder=? WHERE bug_id=? AND id =?.
After pressing the back button,
[EDIT: breaking long line to avoid scrolling]
I see the same effect in version 1.3.1.
|Tags||No tags attached.|
Updating product version since you mentioned it's also not working in 1.3.1
Tracing through the code, I find this. I added 2 log_events:
2017-02-09 15:04 PST FILE file_api.php:1075 file_move_bug_attachments() Moving attachment /var/mantis/attachments/4/39998f17602597954629f59cc6bcf97b to /var/mantis/attachments/84/39998f17602597954629f59cc6bcf97b
2017-02-09 15:04 PST DB file_api.php:1087 file_move_bug_attachments() array (
log_event(LOG_FILE,'Moving attachment ' . $t_disk_file_name_from . ' to ' . $t_disk_file_name_to);
The relevant code bits near mantis/htdocs/core/file_api.php:1060
I think just leave off the 'false' at the end of the db_query should fix it.
db_query( $t_query_disk_attachment_update, array( db_prepare_string( $t_path_to ), $c_bug_id, (int)$t_row['id'] ));
I've applied the patch proposed in 0021994:0055627 to my mantis 1.3.4 installation ( line no. 1085 in core/file_api.php of that release).
Notably the comment in the line preceeding the offending line points to a wrong conclusion drawn during programming that section:
is there any chance to get the bug fixed (resp. to get the proposed patch accepted) in 1.3.x ?
I am having this exact same issue in v2.3.1
I am going to try dropping the 'false' at the end of db_query tonight after hours per peter's earlier post as a temporary solution.
Please note that the proposed workaround of dropping the
The fix proposed in PR https://github.com/mantisbt/mantisbt/pull/1110 follows the correct approach of providing the default values for $p_limit and $p_offset.
Positively tested the patch in 0021994:0056862 in a mantis 1.3.1 and 1.3.4 environment.
In the meantime I had also seen problems with the removed "false", but I was so sure I had written that as a note to that bug that I didn't check it, sorry.
Thanks for the update. I've tested on 2.3.1 and it seems to be working fine now.
MantisBT: master 33e1230b
Committer: dregad Details Diff
|Fix moving issues with attachments
Issues with attachments cannot be moved between projects with different
upload directories when files are stored in file system.
Add missing parameters to db_query() call in file_move_bug_attachments().
|mod - core/file_api.php||Diff File|
|2016-11-30 10:20||tk||New Issue|
|2016-11-30 11:24||dregad||Status||new => acknowledged|
|2016-11-30 11:24||dregad||Product Version||1.3.4 => 1.3.1|
|2016-11-30 11:24||dregad||Description Updated||View Revisions|
|2016-11-30 11:24||dregad||Note Added: 0054646|
|2017-01-26 16:56||atrol||Relationship added||has duplicate 0022264|
|2017-02-09 19:21||petergruenbeck||Note Added: 0055626|
|2017-02-09 19:46||petergruenbeck||Note Added: 0055627|
|2017-02-14 04:20||tk||Note Added: 0055668|
|2017-03-17 08:17||tk||Note Added: 0056102|
|2017-05-04 17:56||jbarker||Note Added: 0056775|
|2017-05-16 06:17||dregad||Note Added: 0056862|
|2017-05-16 08:52||tk||Note Added: 0056864|
|2017-05-16 15:58||jbarker||Note Added: 0056870|
|2017-05-20 08:16||dregad||Changeset attached||=> MantisBT master 33e1230b|
|2017-05-20 08:16||dregad||Assigned To||=> dregad|
|2017-05-20 08:16||dregad||Status||acknowledged => resolved|
|2017-05-20 08:16||dregad||Resolution||open => fixed|
|2017-05-20 08:16||dregad||Fixed in Version||=> 2.5.0|
|2017-05-20 11:54||atrol||Target Version||=> 2.5.0|
|2017-06-04 14:58||vboctor||Status||resolved => closed|