Issue #2039649 by JvE, mikeryan: Smarter setting of file 'type' field