Opened 10 years ago

Closed 10 years ago

#759 closed defect (fixed)

WCPS encode behaviour dependent on capitalisation of format specifier

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

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 (8)

comment:1 by Dimitar Misev, 10 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, 10 years ago

Description: modified (diff)

comment:3 by Dimitar Misev, 10 years ago

Description: modified (diff)

comment:4 by Marcus Sen, 10 years ago

Why has rasql query in description been modified from the one I pasted from the logs?

comment:5 by Dimitar Misev, 10 years ago

It was missing the from clause, I was assuming it's a copy-paste error?

comment:6 by Dimitar Misev, 10 years ago

Description: modified (diff)

Ah no, I just realized it had an extraneous ')' at the end, not missing a from clause actually.. fixing now.

comment:8 by uadhikari, 10 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.