protected async Task <IEnumerable <PersonInfo> > SanitizeEmptyImagePersonInfos(IEnumerable <PersonInfo> images) { using var httpClient = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false }, true); var sanitizer = new RemoteImageUrlSanitizer(httpClient); var res = await Task.WhenAll(images.Select(async p => { p.ImageUrl = await sanitizer.SanitizeRemoteImageUrl(p.ImageUrl); return(p); })); return(res.Where(i => i != null).ToArray()); }
protected async Task <IEnumerable <RemoteImageInfo> > FilterEmptyImages(IEnumerable <RemoteImageInfo> images) { using var httpClient = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false }, true); var sanitizer = new RemoteImageUrlSanitizer(httpClient); var res = await Task.WhenAll(images.Select(async i => { var sanitizedUrl = await sanitizer.SanitizeRemoteImageUrl(i.Url); if (string.IsNullOrEmpty(sanitizedUrl)) { return(null); } i.Url = sanitizedUrl; return(i); })); return(res.Where(i => i != null).ToArray()); }