magda-io / magda

A federated, open-source data catalog for all your big data and small data
https://magda.io
Apache License 2.0
493 stars 93 forks source link

Correspondence API might reset the preset email resources to the default data unexpectedly during the service restart #3527

Closed t83714 closed 1 month ago

t83714 commented 1 month ago

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.

t83714 commented 1 month ago

closed via PR: https://github.com/magda-io/magda/pull/3529 released a new version: https://github.com/magda-io/magda/releases/tag/v3.0.4