Beispiel #1
0
        public async Task <IActionResult> GetSpecificItem([FromRoute] ulong guildId, [FromRoute] int caseId, [FromRoute] string filename)
        {
            if (!_config.IsPublicFileEnabled())
            {
                await RequirePermission(guildId, caseId, APIActionPermission.View);
            }

            UploadedFile fileInfo = FileRepository.CreateWithBotIdentity(_serviceProvider).GetCaseFile(guildId, caseId, filename);

            HttpContext.Response.Headers.Add("Content-Disposition", fileInfo.ContentDisposition.ToString());
            HttpContext.Response.Headers.Add("Content-Type", fileInfo.ContentType);

            return(File(fileInfo.FileContent, fileInfo.ContentType));
        }