The approach that we recommend is to delete attachments in the `"sync"` event callback. This is not fully reliable, e.g. if the browser crashes or the computer shuts down while this happens, then stale files aren't removed. We could delete stale files automatically, during the 24H timer for example.
Bug 1763626 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The approach that we recommend [in the docs](https://firefox-source-docs.mozilla.org/services/settings/index.html#file-attachments) is to delete attachments in the `"sync"` event callback. This is not fully reliable. For example, if the browser crashes or the computer shuts down while the “sync” event listener executes, then then we can have some stale attachments downloaded in the profile that won’t match any record on the server. The goal of the bug is to regularly scan / compare / delete stale download attachments. During [the 24H timer](https://searchfox.org/mozilla-central/rev/24c1cdc33ccce692612276cd0d3e9a44f6c22fd3/services/settings/RemoteSettingsComponents.jsm#20-24) for example.