Resolve #1433 to free memory and #1434 to guess file types with less advanced mime check