Correspondence API might reset the preset email resources to the default data unexpectedly during the service restart
When checking if a preset data/resource is available, the correspondence API will consider the preset data/resource is not available when a fetch request fails for any reason. This could lead to incorrect decisions when a preset resource exists but content API is temporarily unavailable. Consequently, the system's default resources will be uploaded, and the preset email template & resources might be overwritten incorrectly.
We should only consider that the preset data/resource is unavailable when we receive a clear 404 response ONLY. Any other non-ok response should trigger an exception instead.
Correspondence API might reset the preset email resources to the default data unexpectedly during the service restart
When checking if a preset data/resource is available, the correspondence API will consider the preset data/resource is not available when a fetch request fails for any reason. This could lead to incorrect decisions when a preset resource exists but content API is temporarily unavailable. Consequently, the system's default resources will be uploaded, and the preset email template & resources might be overwritten incorrectly.
https://github.com/magda-io/magda/blob/a91ad53b8160f12494dbdf422de28752ce9dd761/magda-correspondence-api/src/ContentApiDirMapper.ts#L83
We should only consider that the preset data/resource is unavailable when we receive a clear 404 response ONLY. Any other non-ok response should trigger an exception instead.