Files
Martin-Molinero 5701f1c740 Make remote custom-data downloads robust to transient empty/failed responses (#9544)
* Retry transient empty/failed remote custom-data downloads

A remote custom-data source can intermittently answer with a transient failure or
a successful-but-empty body (e.g. an HTTP 200 with no content from a proxied
endpoint). Previously a single such response made RemoteFileSubscriptionStreamReader
treat it as the file contents: an empty byte[] passed the 'bytes != null' check and
was written/cached as a valid (empty) file, so the whole subscription silently
yielded no data and, with caching enabled, reused the empty file.

Download with a bounded retry that treats an empty response or an exception as
transient, and only persist/cache a non-empty result. On HTTP errors a WebException
is still thrown after the retries are exhausted, preserving existing behavior.

Adds tests: retry recovers after empty responses, and an empty download is not cached.

* Update RemoteFileSubscriptionStreamReader.cs
2026-06-22 10:35:21 -03:00
..