View Issue Details

IDProjectCategoryView StatusLast Update
0012837mantisbtdb postgresqlpublic2016-07-19 10:29
Reporterdforce Assigned Todregad  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
PlatformMicrosoftOSWindowsOS Version2008 R2
Product Version1.2.4 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0012837: Download Attachment doesn't work; Get some header information or Jabber
Description

uploading a file works fine so far, but if i try to download an attachment, i sometimes only get a text-file with a lots of jabber like:
替㕥〷㘰〹㘰づ㘰〴㘰て㜰〷㜰〳㈰〰㔰〲㘰〵㘰

ans sometimes the file is opened in the browser and i see something like:

022003d0022003220006400650022000d000a00...
HTTP/1.1 200 OK
Cache-Control: private, max-age=10800, pre-check=10800
Pragma: no-cache
Content-Length: 6704
Content-Type: text/plain; charset=iso-8859-1
Expires: Fri, 04 Mar 2011 14:34:46 GMT
Last-Modified: Fri, 04 Mar 2011 14:13:07 GMT
Server: Microsoft-IIS/7.5
X-Powered-By: PHP/5.3.5
X-Frame-Options: DENY
X-Content-Security-Policy: allow 'self'; options inline-script eval-script; frame-ancestors 'none'
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename*=UTF-8''reg_file.reg; filename="reg_file.reg"
X-Powered-By: ASP.NET
Date: Fri, 04 Mar 2011 14:34:45 GMT

ÿfe570069006e0064006f0077007300200052006...

Steps To Reproduce
  • upload a reg-file
  • try to download it
Additional Information
  • mantis 1.2.4
  • windows 2008 r2 with IIS7
  • php-5.3.5-nts-Win32-VC9-x86
  • postgres 9 / UTF8

open_basedir = "C:\inetpub\wwwroot;C:\inetpub\temp;C:\inetpub\upload;"
upload_tmp_dir="C:\inetpub\upload"
with read/write access for IUSR

  • the project itself has no upload directory defined.
  • save uploads to DATABASE
Tagsattachment, documentation-needed, download, iis, postgresql, utf8, windows

Relationships

has duplicate 0013405 closedatrol File attachments are corrupted on PostgreSQL 
has duplicate 0017151 closeddregad Attachment corrupted on PostgreSQL 
related to 0021380 new Cannot store file attachments in postgresql 
child of 0013713 closeddregad Upgrade ADOdb library to latest version 

Activities

muralito

muralito

2011-03-17 20:49

reporter   ~0028434

Last edited: 2011-03-17 20:50

Postgres 9.0 changed default encoding for bytea.

http://www.postgresql.org/docs/9.0/static/datatype-binary.html

Current PHP pgsql function pg_unescape_bytea does not support this new encoding.

http://www.php.net/manual/en/function.pg-unescape-bytea.php

The workaround is to configure a property in the postgres database for the mantisbt user, to make postgres behave as the old default.

ALTER USER mantisbt SET bytea_output = 'escape';

(or using the pgadmin interface)

All the files already uploaded can be downloaded ok after this change.

I had this problem, and solved it yesterday. I tested and reproduced it in RHEL 5.5 and opensuse 11.3 and 11.4.

The problem also affect mantis 1.2.3 (and probably older versions)

dforce

dforce

2011-03-18 08:13

reporter   ~0028441

Thanks a lot for this hint!

After I executed the query and added C:\PHP\magic\ to the open base dir path in the php.ini it works!

dforce

dforce

2011-03-25 06:08

reporter   ~0028476

also possible and maybe more useful:

ALTER DATABASE mantisbt SET bytea_output = 'escape';

dregad

dregad

2012-08-08 05:41

developer   ~0032501

I confirm that dforce's workaround (0012837:0028476) is a good solution to this issue.

The problem with the incorrect decoding of BLOB (bytea) columns lies in the underlying ADOdb library ADORecordSet_postgres64::_decode() function. This has been fixed in ADOdb version 5.14 (MantisBT 1.2.x currently ships with 5.10).