aquametalabs / aquameta

Web development platform built entirely in PostgreSQL
GNU General Public License v3.0
1.1k stars 52 forks source link

endpoint: bytea columns not being encoded properly #125

Closed erichanson closed 5 years ago

erichanson commented 5 years ago

So when we store a binary like say an image in a bytea column, say my_app.images.image, we can get a URL to that exact field's value with

endpoint.schema('my_app').table('images').rows('id',12345).then(function(image) {
    var href = image.field('image').to_url();
});

Then href should contain the URL of that field's value. This works.

The mimetype of fields in this column can be set with endpoint.column_mimetype. The webserver looks up the column's mimetype and serves the resource accordingly. This works.

However, images aren't coming through properly due to some kind of encoding issue.

The resource is encoded in the database using encode(content,'escape'). Then the webserver converts it to base64 with a2b_base64().

Something in this pipeline is not working.

erichanson commented 5 years ago

Suspect this was caused by the bytea_output setting that got fouled up. Closing for now.