Bug #7215
openMetacat produces an invalid ZIP archive when a package member has an invalid formatID
0%
Description
I submitted a new Data Package and went to download it via the Download All button In MetacatUI which triggers the /packages route in Metacat. I then tried to unzip it and couldn't get any of my zip extraction tools to do it. Then I hex dumped it:
bryce@mbp ~/Downloads> hexdump -C resource_map_urn-uuid-13c3000d-09b1-453b-86d7-e852d147fb81.rdf7b2b468205c3.zip
00000000 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 |<?xml version="1|
00000010 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 |.0" encoding="UT|
00000020 46 2d 38 22 3f 3e 3c 65 72 72 6f 72 20 64 65 74 |F-8"?><error det|
00000030 61 69 6c 43 6f 64 65 3d 22 30 30 30 30 22 20 65 |ailCode="0000" e|
00000040 72 72 6f 72 43 6f 64 65 3d 22 34 30 34 22 20 6e |rrorCode="404" n|
00000050 61 6d 65 3d 22 4e 6f 74 46 6f 75 6e 64 22 3e 0a |ame="NotFound">.|
00000060 20 20 20 20 3c 64 65 73 63 72 69 70 74 69 6f 6e | <description|
00000070 3e 54 68 65 20 66 6f 72 6d 61 74 20 73 70 65 63 |>The format spec|
00000080 69 66 69 65 64 20 62 79 20 4e 41 20 77 61 73 20 |ified by NA was |
00000090 6e 6f 74 20 66 6f 75 6e 64 20 61 66 74 65 72 20 |not found after |
000000a0 72 65 66 72 65 73 68 69 6e 67 20 74 68 65 20 63 |refreshing the c|
000000b0 61 63 68 65 2e 3c 2f 64 65 73 63 72 69 70 74 69 |ache.</descripti|
000000c0 6f 6e 3e 0a 3c 2f 65 72 72 6f 72 3e 0a |on>.</error>.|
000000cd
Which looks like Metacat wrote out an XML file and called it a .ZIP. After seeing this particular error message, I realized that Metacat was choking on the "NA" formatId on the Data Object I put in this package. Fair enough I guess.
I think Metacat did two things that were surprising to me:
1. Didn't produce what I asked for even though it reasonably could have (Metacat doesn't need to know the formatID to send me the file)
2. Didn't produce any error message (e.g., a non-200 HTTP status) and instead sent me an invalid ZIP file
No data to display