Foiling zero-error attacks against coherent-one-way quantum key distribution