Skip to content

Commit

Permalink
it works now
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilLord666 committed Apr 29, 2022
1 parent c71ce37 commit 4d330e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ public async Task<IActionResult> GenerateAsync([FromBody] GenerationModel genera
Inline = false
};
Response.Headers.Add("Content-Disposition", content.ToString());
//return File()
// Response.AppendHeader("Content-Disposition", cd.ToString());
return File(bytes, _expectedMimeTypes[reportExtension], $"Report{reportExtension}");
return File(bytes, _expectedMimeTypes[reportExtension], Path.GetFileName(reportFile));
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,16 @@
var parts = contentDisposition.split(" ");
var fileNamePair = parts[1];
var fileNameParts = fileNamePair.split("=");
var fileNameStatement = fileNameParts[1];
// removing trash from filename ...
fileNameStatement = fileNameStatement.replace(";", "");
fileNameStatement = fileNameStatement.replace("\"", "");
var blob = new Blob([response], { type: contentType });
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileNameParts[1];
link.download = fileNameStatement;
link.click();
URL.revokeObjectURL(link.href);
}});
Expand Down

0 comments on commit 4d330e9

Please sign in to comment.