getAttachment doesn't handle revisions

The getAttachment function doesn't allow the retrieval of attachments of a given revision; this patch allows this without -hopefully- breaking existing code: