fix newline handling bug in direct_links API dehydration