digital-preservation / droid

DROID (Digital Record and Object Identification)
BSD 3-Clause "New" or "Revised" License
275 stars 74 forks source link

Internal API does not return an extension value when file is unidentified #1126

Open paulyoung84 opened 3 weeks ago

paulyoung84 commented 3 weeks ago

API does not return a value for extension when it is unidentified, it does in UI and cmd line DROID. Example attached.

Capture2 Capture
sparkhi commented 3 weeks ago

Steps to reproduce: 1) Create a plain text file 2) Change its extension to be PDF

Such file is neither identified by signature nor by extension. Run such file through internal API and you will notice that the extension of he file is not reported

sparkhi commented 3 weeks ago

This is more complicated. If you look at this class uk.gov.nationalarchives.droid.internal.api.ApiResult you will notice that the class contains all the returned values, however when there is no successful identification, there is no IdentificationResults object at all, hence no other details too. I guess the best option is for the caller of the API to extract the extension from the request.