View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012955 | mantisbt | attachments | public | 2011-04-21 09:15 | 2015-07-10 15:01 |
Reporter | pingo | Assigned To | dregad | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.5 | ||||
Target Version | 1.2.16 | Fixed in Version | 1.2.16 | ||
Summary | 0012955: After updating a project documentation the file is damaged | ||||
Description | After updating a project documentation the file is damaged | ||||
Steps To Reproduce |
| ||||
Additional Information | My setup: | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
related to | 0013247 | closed | dregad | mantisbt | Bug in file "proj_doc_update.php" |
related to | 0014541 | closed | dregad | mantisbt | Remove calls to deprecated functions db_prepare* in "Docs" update page |
has duplicate | 0009578 | closed | dregad | mantisbt | Binary data corrupted in MySQL |
has duplicate | 0016639 | closed | dregad | mantisbt | Project Documentation - pdf file corrupt after upload |
related to | 0014563 | closed | dregad | mantisbt | Use of literal SQL statement causes ORA-01704 error when uploading attachments |
related to | 0019926 | closed | SL-Gundam | Plugin - EmailReporting | Error when submitting a bug by email (via EmailReporting) due to the change in the "core/database_api" line 761 |
I know that this bug report came before 0013247, but that bug report has a solution whereas this doesn't. |
|
Sorry, not a duplicate. Repoening. |
|
File proj_doc_update.php line 105 Change:- case DATABASE: to:- case DATABASE: |
|
I changed line 105 and line 54 (0013247). This works for me. |
|
David, I'm afraid that your proposed fix would only work for MySQL - other DB engines rely on BLOB fields to be escaped/encoded properly (look at db_prepare_binary_string). |
|
I think I figured it out. See https://github.com/dregad/mantisbt/commits/file-attach-fixes - testing and feedback welcome :-) |
|
How to download a tarball with the "file-attach-fixes"? Please provide a link or a git-command. |
|
You can download it from the link is in my previous post 0012955:0032538 |
|
I tested the software from https://github.com/dregad/mantisbt/tarball/file-attach-fixes, problem is solved, no damaged files anymore. |
|
Thanks for your feedback, I'll include that in the next release then. |
|
Just upgraded to 1.2.15 and this is still broken. |
|
David This is targeted at 1.2.x which means it would be included in 1.2.16 -- assuming I get around to merging the changes ;-) Until then, feel free to apply the patch from my github branch on top of your 1.2.15 instance, and please report here if you experience any issues. |
|
MantisBT: master-1.2.x 3008c7f7 2012-08-09 08:36 Damien Regad Details Diff |
Fix encoding of BLOB columns The db_prepare_binary_string() function was designed for use with db_query(), and therefore used to surround the binary string to encode with single quotes. Use of db_query_bound() with the function's return value would result in a corrupted attachment because the quotes would be treated as integral part of the binary data. MySQL does not require any special encoding (except regular string processing which is already done by db_query_bound()). For PostgreSQL, instead of calling pg_escape_bytea() directly, we now use ADOdb connection's BlobEncode() method. MSSQL encoding was left as is was (no test platform available). Based on documentation, Oracle (oci8) should not require any encoding either, but was not tested either. Fixes 0012955 |
Affected Issues 0012955 |
|
mod - core/database_api.php | Diff File |