Exemplo n.º 1
0
        public async Task <IActionResult> GetGif(string id)
        {
            var file = await _icons.GetGif(id);

            if (file == null)
            {
                return(NotFound("Invalid file ID given."));
            }
            var stream = await _icons.GetGifContent(id);

            var toRespond = new FileStreamResult(stream, "image/gif");
            var cd        = new ContentDisposition
            {
                Inline   = true,
                FileName = file.FileName
            };

            Response.Headers["Content-Disposition"]    = cd.ToString();
            Response.Headers["X-Content-Type-Options"] = "nosniff";
            return(toRespond);
        }