Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <[email protected]>
  • Loading branch information
jortel committed Aug 9, 2024
1 parent ca9da4d commit 3b23949
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
11 changes: 2 additions & 9 deletions api/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ const (
AppAnalysisIssuesRoot = AppAnalysisRoot + "/issues"
)

const (
IssueField = "issues"
DepField = "dependencies"
)

// AnalysisHandler handles analysis resource routes.
type AnalysisHandler struct {
BaseHandler
Expand Down Expand Up @@ -375,8 +370,7 @@ func (h AnalysisHandler) AppCreate(ctx *gin.Context) {
defer func() {
_ = reader.Close()
}()
encoding := ctx.Request.Header.Get(ContentType)
d, err := h.Decoder(ctx, encoding, reader)
d, err := h.Decoder(ctx, file.Encoding, reader)
if err != nil {
err = &BadRequestError{err.Error()}
_ = ctx.Error(err)
Expand Down Expand Up @@ -421,8 +415,7 @@ func (h AnalysisHandler) AppCreate(ctx *gin.Context) {
defer func() {
_ = reader.Close()
}()
encoding = ctx.Request.Header.Get(ContentType)
d, err = h.Decoder(ctx, encoding, reader)
d, err = h.Decoder(ctx, file.Encoding, reader)
if err != nil {
err = &BadRequestError{err.Error()}
_ = ctx.Error(err)
Expand Down
4 changes: 2 additions & 2 deletions hack/add/analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ echo "Report (files) GENERATED"

#
# Post issues.
code=$(curl -kSs -o ${tmp} -w "%{http_code}" -F "file=@${iPath}" http://${host}/files/issues)
code=$(curl -kSs -o ${tmp} -w "%{http_code}" -F "file=@${iPath};type=application/x-yaml" http://${host}/files/issues)
if [ ! $? -eq 0 ]
then
exit $?
Expand All @@ -214,7 +214,7 @@ case ${code} in
esac
#
# Post deps.
code=$(curl -kSs -o ${tmp} -w "%{http_code}" -F "file=@${dPath}" http://${host}/files/deps)
code=$(curl -kSs -o ${tmp} -w "%{http_code}" -F "file=@${dPath};application/x-yaml" http://${host}/files/deps)
if [ ! $? -eq 0 ]
then
exit $?
Expand Down
2 changes: 1 addition & 1 deletion hack/add/file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ host="${HOST:-localhost:8080}"
path="${1:-/etc/hosts}"
name=$(basename ${path})

curl -F "file=@${path};type=application/x-yaml" http://${host}/files/${name} | jq .
curl -F "file=@${path}" http://${host}/files/${name} | jq .

0 comments on commit 3b23949

Please sign in to comment.