Details
-
Type:
Bug
-
Status: Received
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: Fedora 4.7.2, Fedora 4.7.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Jetty standalone; Tomcat with postgres
Description
If the ebucore:hasMimeType value of an 'fcr:metadata' resource has an invalid mimetype string, such as "audio/3gpp, video/3gpp", Fedora will throw a 500 error when requesting the binary content:
curl -X GET http://host/binary
java.lang.IllegalArgumentException: Error parsing media type 'audio/3gpp, video/3gpp'
at org.glassfish.jersey.message.internal.MediaTypeProvider.fromString(MediaTypeProvider.java:92)
at org.glassfish.jersey.message.internal.MediaTypeProvider.fromString(MediaTypeProvider.java:60)
at javax.ws.rs.core.MediaType.valueOf(MediaType.java:179)
To reproduce:
1) Create a binary resource.
2) Modify the ebucore:hasMimeType value so that it contains two mimetype strings separated by a comma.
3) Try to GET the binary.
This is a data issue caused by a client PATCHing the hasMimeType value with an invalid 'mimetype'. It's fairly easily avoided and it's readily fixed by correcting the value.
That said, it may be worth considering performing a check on the mimetype value and serving the bytes with a generic application/octet-stream content type when an invalid mimetype is detected.
Attachments
Issue Links
- duplicates
-
FCREPO-2520 Improve mimetype validation
-
- Closed
-