Limit list of allowed file extensions

From #2214.