When listing a directory, all elements have content type as octet stream, even folders

Identify a folder through its resource type (if it is a collection), and set the correct content type of the element