* BlogsController.cs: fixes the bug rendering the avatar

* GoogleController.cs: fixes the bug at reusing the same url in a
  (Http)WebRequest (call Abort() when finiched)
This commit is contained in:
Paul Schneider 2015-01-12 14:18:20 +01:00
commit 29046a3e07
2 changed files with 58 additions and 12 deletions

View file

@ -246,9 +246,16 @@ namespace Yavsc.Controllers
return File (fia.OpenRead (), defaultAvatarMimetype);
}
WebRequest wr = WebRequest.Create(avpath);
WebResponse resp = wr.GetResponse ();
Stream str = resp.GetResponseStream ();
return File (str, resp.ContentType);
FileContentResult res;
using (WebResponse resp = wr.GetResponse ()) {
using (Stream str = resp.GetResponseStream ()) {
byte [] content = new byte[str.Length];
str.Read (content, 0, (int) str.Length);
res = File (content, resp.ContentType);
wr.Abort ();
return res;
}
}
}
/// <summary>