| Anonymous | Login | Signup for a new account | 2013-05-21 13:23 EDT | ![]() |
| Main | My View | View Issues | Change Log | Roadmap | Wiki | ManTweet | Repositories |
| View Issue Details [ Jump to Notes ] [ Wiki ] [ Related Changesets ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0013415 | mantisbt | attachments | public | 2011-10-17 10:53 | 2013-04-06 09:23 | ||||
| Reporter | adminactoll | ||||||||
| Assigned To | rombert | ||||||||
| Priority | normal | Severity | major | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | OS | OS Version | |||||||
| Product Version | 1.2.8 | ||||||||
| Target Version | 1.2.12 | Fixed in Version | 1.2.12 | ||||||
| Summary | 0013415: cloning issue with attachments doesn't work | ||||||||
| Description | (Sorry for my bad english) When I try to clone a bug with attached file, it doesn't work. The error message is : SYSTEM WARNING : copy(...) [function.copy]: failed to open stream: No such file or directory SYSTEM WARNING: chmod() [function.chmod]: No such file or directory The attached file is correctly uploaded in the original bug report and I'm able to open attached file (in original bug report) correctly. I spent time to debug this problem andI think the error is in file core/file_api.php between line 873 and 883. | ||||||||
| Steps To Reproduce | Clone a bug report with attached file (with the box "clone attachments" selected). | ||||||||
| Additional Information | ... $t_file_path = dirname( $t_bug_file['folder'] ); $t_new_diskfile_name = $t_file_path . file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); ... copy( $t_bug_file['diskfile'], $t_new_diskfile_name ); ... #Error 1: function dirname returns parent directory of the parameter. When the variable $t_new_diskfile_name is created, projet folder of bug report is missing : so, new destintation file is invalid. #Error 2: About the first parameter of copy function, path of original attached file is missing. I resolve the problem with : $t_file_path = $t_bug_file['folder']; instead of $t_file_path = dirname( $t_bug_file['folder'] ); AND copy( $t_file_path.$t_bug_file['diskfile'], $t_new_diskfile_name ); instead of copy( $t_bug_file['diskfile'], $t_new_diskfile_name ); | ||||||||
| Tags | 2.0.x check | ||||||||
| Attached Files | |||||||||
Relationships |
||||||
|
||||||
Notes |
|
|
rombert (developer) 2011-10-17 10:56 |
Will look into this, thanks. |
|
rombert (developer) 2011-11-14 17:07 |
Thanks for the report and the patch, I've applied the fix for both 1.2 and 1.3 . For the future, you could submit pull requests using github to get proper attribution in the codebase. |
|
belfar (reporter) 2011-11-23 18:39 |
teste |
|
TomR (reporter) 2011-12-23 11:25 edited on: 2011-12-23 11:26 |
I think this does not cover all of it. My understanding is that in mantis_bug_table the field 'diskfile' should only contains the generated filename WITHOUT the path, because the path is stored in field 'folder'. However in that case the patch is not complete: You should change line 873 from $t_new_diskfile_name = $t_file_path . file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); into $t_new_diskfile_name = file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); |
|
rombert (developer) 2011-12-27 05:41 |
@TomR: Can you give me an example configuration and steps to reproduce? |
|
brahms (reporter) 2012-02-05 04:35 |
v1.1.18, in mantis_bug_table the field 'diskfile' includes the path, but in v2.1.8, in mantis_bug_table the field 'diskfile' does not includes the path. in 2.1.8, when I change project path, all attachments missing, wow, see attachment. |
|
rombert (developer) 2012-02-08 13:21 |
(In reply to comment 0013415:0031124) > v1.1.18, in mantis_bug_table the field 'diskfile' includes the path, but in > v2.1.8, in mantis_bug_table the field 'diskfile' does not includes the path. > in 2.1.8, when I change project path, all attachments missing, wow, see > attachment. This seems unrelated to the bug report, please use the forums for support or open a new bug. |
|
atrol (developer) 2012-02-16 06:49 |
Reopened based on TomR's input 0013415:0030679 1. set $g_file_upload_method = DISK; and adjust "Upload Path" setting of your project 2. Enter a new issue with attachment 3. Clone the issue including attachment Check column diskfile of table manis_bug_file_table It contains the diskfilename for the original issue but path + diskfilename for the cloned issue |
|
henrywang (reporter) 2012-04-24 03:36 |
Also got the same issue when cloning a bug. And fix the issue with following changes: $t_file_path = $t_bug_file['folder']; instead of $t_file_path = dirname( $t_bug_file['folder'] ); AND copy( $t_file_path.$t_bug_file['diskfile'], $t_new_diskfile_name ); instead of copy( $t_file_path.$t_bug_file['diskfile'], $t_file_path.$t_new_diskfile_name ); AND $t_new_diskfile_name = $t_file_path . file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); instead of $t_new_diskfile_name = file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); Thus a new file will be created in the same folder of the original file and only file name will be saved to the diskfile column of mantis_bug_file_table. |
|
henrywang (reporter) 2012-04-24 03:38 |
the last change should be: $t_new_diskfile_name = file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); instead of $t_new_diskfile_name = $t_file_path . file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path ); BTW, if the new folder is different from the older one, there should be more change to fix it. |
|
rombert (developer) 2012-06-13 16:59 |
I've managed to reproduce the problem and with this fix I've now validated that cloning issues with attachments work as expected - the files are correctly copied and the diskfile entry is correct as well. Can anyone validate this patch for me before committing? |
|
atrol (developer) 2012-06-15 06:57 |
Works for me. diskfile column does not longer contain the path. |
|
rombert (developer) 2012-06-16 07:22 |
(In reply to comment 0013415:0032106) > Works for me. > diskfile column does not longer contain the path. Thanks for confirming. I was not sure my own tests were correct. |
|
grangeway (developer) 2013-04-05 17:56 |
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
Related Changesets |
|||
|
MantisBT: master 46873ebc
Timestamp: 2011-11-14 14:05:10 Author: rombert [ Details ] [ Diff ] |
Fix 0013415 ( cloning issue with attachments doesn't work ) Thanks to adminactoll for providing the patch. |
||
| mod - core/file_api.php | [ Diff ] [ File ] | ||
|
MantisBT: master-1.2.x 0b8298ec
Timestamp: 2011-11-14 14:05:10 Author: rombert [ Details ] [ Diff ] |
Fix 0013415 ( cloning issue with attachments doesn't work ) Thanks to adminactoll for providing the patch. |
||
| mod - core/file_api.php | [ Diff ] [ File ] | ||
|
MantisBT: master-1.2.x 92d2dc3b
Timestamp: 2012-06-16 04:19:25 Author: rombert [ Details ] [ Diff ] |
Fix 0013415: cloning issue with attachments doesn't work | ||
| mod - core/file_api.php | [ Diff ] [ File ] | ||
|
MantisBT: master d8b21506
Timestamp: 2012-06-16 04:19:25 Author: rombert [ Details ] [ Diff ] |
Fix 0013415: cloning issue with attachments doesn't work | ||
| mod - core/file_api.php | [ Diff ] [ File ] | ||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-10-17 10:53 | adminactoll | New Issue | |
| 2011-10-17 10:56 | rombert | Note Added: 0029973 | |
| 2011-10-17 10:56 | rombert | Assigned To | => rombert |
| 2011-10-17 10:56 | rombert | Status | new => acknowledged |
| 2011-11-14 17:01 | rombert | Status | acknowledged => assigned |
| 2011-11-14 17:01 | rombert | Target Version | => 1.2.9 |
| 2011-11-14 17:01 | rombert | Description Updated | View Revisions |
| 2011-11-14 17:01 | rombert | Additional Information Updated | View Revisions |
| 2011-11-14 17:07 | rombert | Note Added: 0030236 | |
| 2011-11-14 17:07 | rombert | Status | assigned => resolved |
| 2011-11-14 17:07 | rombert | Resolution | open => fixed |
| 2011-11-14 17:07 | rombert | Fixed in Version | => 1.2.9 |
| 2011-11-16 16:08 | rombert | Changeset attached | => MantisBT master 46873ebc |
| 2011-11-16 16:08 | rombert | Changeset attached | => MantisBT master-1.2.x 0b8298ec |
| 2011-11-23 18:39 | belfar | Note Added: 0030303 | |
| 2011-12-23 11:25 | TomR | Note Added: 0030679 | |
| 2011-12-23 11:26 | TomR | Note Edited: 0030679 | View Revisions |
| 2011-12-27 05:41 | rombert | Note Added: 0030709 | |
| 2012-02-05 04:35 | brahms | Note Added: 0031124 | |
| 2012-02-05 04:36 | brahms | File Added: attachementfile_diskfile_folder.jpg | |
| 2012-02-08 13:21 | rombert | Note Added: 0031196 | |
| 2012-02-16 06:49 | atrol | Note Added: 0031250 | |
| 2012-02-16 06:49 | atrol | Status | resolved => feedback |
| 2012-02-16 06:49 | atrol | Resolution | fixed => reopened |
| 2012-03-04 09:23 | atrol | Target Version | 1.2.9 => 1.2.10 |
| 2012-04-02 02:33 | atrol | Target Version | 1.2.10 => 1.2.11 |
| 2012-04-24 03:36 | henrywang | Note Added: 0031707 | |
| 2012-04-24 03:38 | henrywang | Note Added: 0031708 | |
| 2012-06-07 13:42 | atrol | Fixed in Version | 1.2.9 => |
| 2012-06-07 13:42 | atrol | Target Version | 1.2.11 => 1.2.12 |
| 2012-06-07 13:42 | atrol | Description Updated | View Revisions |
| 2012-06-07 13:42 | atrol | Additional Information Updated | View Revisions |
| 2012-06-13 16:59 | rombert | File Added: 13415-v1.patch | |
| 2012-06-13 16:59 | rombert | Note Added: 0032093 | |
| 2012-06-15 06:57 | atrol | Note Added: 0032106 | |
| 2012-06-16 07:21 | rombert | Changeset attached | => MantisBT master-1.2.x 92d2dc3b |
| 2012-06-16 07:21 | rombert | Status | feedback => resolved |
| 2012-06-16 07:21 | rombert | Fixed in Version | => 1.2.12 |
| 2012-06-16 07:21 | rombert | Changeset attached | => MantisBT master d8b21506 |
| 2012-06-16 07:22 | rombert | Note Added: 0032111 | |
| 2012-06-16 07:22 | rombert | Resolution | reopened => fixed |
| 2012-06-16 07:22 | rombert | Description Updated | View Revisions |
| 2012-06-16 07:22 | rombert | Additional Information Updated | View Revisions |
| 2012-11-10 18:54 | dregad | Status | resolved => closed |
| 2013-04-05 17:56 | grangeway | Status | closed => acknowledged |
| 2013-04-05 17:56 | grangeway | Note Added: 0036148 | |
| 2013-04-05 19:27 | grangeway | Relationship added | related to 0015721 |
| 2013-04-06 03:40 | dregad | Status | acknowledged => closed |
| 2013-04-06 07:23 | grangeway | Status | closed => acknowledged |
| 2013-04-06 09:22 | dregad | Tag Attached: 2.0.x check | |
| 2013-04-06 09:23 | dregad | Status | acknowledged => closed |
| MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1693 seconds. memory usage: 2,943 KB |