ERDatabaseAttachmentProcessor not returning uploaded file verbatim
ERDatabaseAttachmentProcessor not returning uploaded file verbatim
- Subject: ERDatabaseAttachmentProcessor not returning uploaded file verbatim
- From: Paul Hoadley <email@hidden>
- Date: Wed, 11 Sep 2013 20:30:48 +0930
Hello,
I'm not having a great week. In development, I'm using the "db" storage type backed by PostgreSQL (9.1). The tables are set up by migrations, and erattachmentdata.data is of type 'bytea', which looks fine. I've now hit the following problem:
1. Among other file types, I'm uploading some simple CSV files, parsing them and then creating attachments from them (as described in another thread). When I upload a file, save, and then view the attachment using an ERAttachmentIcon, the content is returned as expected.
2. If I stop the app, restart it, and view the same attachment, I get a long string which is the hex representation of the file, but slightly mangled at the start. For example, here are the first few bytes of a CSV file viewed in the terminal:
0000000 4c 6f 63 6b 2c 41 75
Here are those same first few bytes viewed in the table with psql:
\x4c6f636b2c4175
That looks good to me—the '\x' just denotes PostgreSQL's hex representation.
And here's the first few bytes of what the browser returns after clicking the attachment icon:
S6f636b2c4175
So it's displaying the literal string of octets, though it's dropped the first '4c' and replaced it with an 'S'. I get the same string if I grab an InputStream from the attachment and print it out.
Has anyone seen anything like this, or would anyone care to guess at what's going on here? I'm not overly worried about it, as I'll be using S3 in production, and the S3 attachment processor does _not_ exhibit this problem—attachments come out of S3 just as they went in. But it would be handy to be using the DB in development.
--
Paul Hoadley
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden