Add bugs 1050447 and 961362
Fix quoting when replacing image links.