#2174 Limiting attachments to 0 doesn't do what is expected (backport)

Backported from k3.1