apply: split quoted filename handling into new function