diff --git a/Slingshot.CCB/Slingshot.CCB/Utilities/Translators/CcbPerson.cs b/Slingshot.CCB/Slingshot.CCB/Utilities/Translators/CcbPerson.cs index abd1b01..0ec3593 100644 --- a/Slingshot.CCB/Slingshot.CCB/Utilities/Translators/CcbPerson.cs +++ b/Slingshot.CCB/Slingshot.CCB/Utilities/Translators/CcbPerson.cs @@ -228,13 +228,22 @@ public static Person Translate( XElement inputPerson ) // CCB encoded key expires too quickly, so download immediately instead of setting person.PersonPhotoUrl Task.Run( () => { - // save image locally - var imageResponse = WebRequest.Create( imageURI ).GetResponse(); - var imageStream = imageResponse.GetResponseStream(); - var path = Path.Combine( ImportPackage.ImageDirectory, "Person_" + person.Id + ".jpg" ); - using ( FileStream output = File.OpenWrite( path ) ) + // Intentionally skip any damaged or troublesome images here: + try { - imageStream.CopyTo( output ); + // save image locally + var imageResponse = WebRequest.Create( imageURI ).GetResponse(); + var imageStream = imageResponse.GetResponseStream(); + var path = Path.Combine( ImportPackage.ImageDirectory, "Person_" + person.Id + ".jpg" ); + using ( FileStream output = File.OpenWrite( path ) ) + { + imageStream.CopyTo( output ); + } + } + catch ( Exception ) + { + // Continue and ignored forbidden files + } } ); }