Opened 11 years ago

Last modified 11 years ago

#759 closed defect

WCPS encode behaviour dependent on capitalisation of format specifier — at Version 3

Reported by: Marcus Sen Owned by: uadhikari
Priority: minor Milestone: 9.0.x
Component: petascope Version: development
Keywords: Cc: James Passmore
Complexity: Medium

Description (last modified by Dimitar Misev)

If I submit the query:

for c in (bgs_rs) return
encode(
        c.blue,
        "png"
        )

I get an image back with the response Content-Type header set to image/png

If I submit the query with "PNG" in capital letters I get the same image back but the response Content-Type header is set to text/plain. (Although with my browser Firefox it pops up a dialog box saying the data is application/octet-stream, presumably deciding that the Content-Type header must be wrong.)

I guess the behaviour should be the same for both or only lowercase or only uppercase versions should be allowed but I don't know where the format specifier strings are defined.

(Both queries get translated to the same underlying rasql query with capital letters:

select encode((c).blue, "PNG", "xmin=314158.77412577;xmax=574363.77412577;ymin=394361.64417978;ymax=632963.64417978;crs=EPSG:27700") from bgs_rs AS c where oid(c)=6145) from bgs_rs as c

Dimitar Misev commented on rasdaman-users list:

Looks like a bug worth a ticket. The format → mimetype correspondence
is defined in the ps_format table.

Change History (3)

comment:1 by Dimitar Misev, 11 years ago

Milestone: 9.0.x
Owner: changed from Piero Campalani to uadhikari
Status: newassigned

Utkrist, the mimetype is set in PetascopeInterface, you can grep in source:applications/petascope/src/main/java for mimetype to get a clue for where the problem is:

cd applications/petascope/src/main/java
grep -i -R mimetype *

I'm suspecting the issue is somewhere in DbMetadataSource, perhaps in the formatToMimetype method.

I'm not sure how to add a test that will check for the mimetype, I think it will be hard to do it in our systemtest so a one-time manual check should be good enough for now.

comment:2 by Dimitar Misev, 11 years ago

Description: modified (diff)

comment:3 by Dimitar Misev, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.