Chose appropriate file name and extension for downloading a subdocument

Fixes issue #12