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

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

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

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