Opened 3 years ago

Closed 3 years ago

#759 closed defect (fixed)

WCPS encode behaviour dependent on capitalisation of format specifier

Reported by: mase Owned by: uadhikari
Priority: minor Milestone: 9.0.x
Component: petascope Version: development
Keywords: Cc: jpass
Complexity: Medium

Description (last modified by dmisev)

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 Changed 3 years ago by dmisev

  • Milestone set to 9.0.x
  • Owner changed from pcampalani to uadhikari
  • Status changed from new to assigned

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 Changed 3 years ago by dmisev

  • Description modified (diff)

comment:3 Changed 3 years ago by dmisev

  • Description modified (diff)

comment:4 Changed 3 years ago by mase

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

comment:5 Changed 3 years ago by dmisev

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

comment:6 Changed 3 years ago by dmisev

  • 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 Changed 3 years ago by uadhikari

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.