cid: links led to a route that did not exist
replaceCidReferences rewrote cid: links in the email HTML to /email/:id/attachment/:file. No such route existed, since attachments are served from /api/... under the configured base path.
A URL with /api and the base path
The URL is now root-relative and includes the base path and /api, so it works at the root and under a subpath such as /mail. A base path of / adds no prefix, and tests also cover base paths given with and without slashes.