Skip to content

Commit

Permalink
Merge pull request #300 from nerdalert/mime-type
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnoianil authored Apr 24, 2024
2 parents dd0a754 + 5a4acc5 commit d377eff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion worker/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,13 @@ func (w *Worker) handleOutputFiles(outputDir, prNumber, outDirName string) strin
})
}

var contentType string
if strings.HasSuffix(filename, ".json") || strings.Contains(filename, "json-viewer.html") {
contentType = "application/json-lines+json"
} else {
contentType = "text/plain"
}

// Upload the job file and add it to the publicFiles list
file, err := os.Open(fullPath)
if err != nil {
Expand All @@ -1100,7 +1107,7 @@ func (w *Worker) handleOutputFiles(outputDir, prNumber, outDirName string) strin
Bucket: aws.String(S3Bucket),
Key: aws.String(upKey),
Body: file,
ContentType: aws.String("application/json-lines+json"),
ContentType: aws.String(contentType),
})
if err != nil {
sugar.Errorf("Could not upload file to S3: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion worker/cmd/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func generateFormattedJSON(ctx context.Context, outputDir, filename string, svc
document.addEventListener("DOMContentLoaded", function() {
var container = document.getElementById('json-editor');
var options = {
mode: 'preview',
mode: 'view',
modes: ['code', 'form', 'text', 'tree', 'view', 'preview']
};
var editor = new JSONEditor(container, options);
Expand Down

0 comments on commit d377eff

Please sign in to comment.