View Issue Details

IDProjectCategoryView StatusLast Update
0021380mantisbtdb postgresqlpublic2016-07-19 10:29
Reportersimtel Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version1.3.0 
Summary0021380: Cannot store file attachments in postgresql
Description

Files inserted in the database are mangled.

It looks like mantis performs a double-escaping: indeed, when you retrieve the file from the db, it starts with \x...

I had to patch the code like this:

if( !db_is_oracle() ) {
//  $t_param['content'] = $c_content;
}
$t_query_param = db_param();
for( $i = 1; $i < count( $t_param ); $i++ ) {
    $t_query_param .= ', ' . db_param();
}

$t_query = 'INSERT INTO ' . $t_file_table . '
    ( ' . implode(', ', array_keys( $t_param ) ) . ', content )
VALUES
    ( ' . $t_query_param . ', \'' . $c_content . "'::bytea )";
db_query( $t_query, array_values( $t_param ) );

this way the file is stored and retried correctly, but it's not a nice way to fix it (especially since any update will require me to patch it again).

I did try to change the bytea_output parameter as per 0012837 but it didn't help

TagsNo tags attached.

Relationships

related to 0012837 closeddregad Download Attachment doesn't work; Get some header information or Jabber 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2016-07-19 10:16 simtel New Issue
2016-07-19 10:29 atrol Relationship added related to 0012837