More robust record importing initialization, fallback to file ext when text is detected

This commit is contained in:
Denis Arh
2020-03-16 12:33:41 +01:00
parent 47db9e7ab9
commit 0c95128bdc
+4
View File
@@ -8,6 +8,7 @@ import (
"github.com/cortezaproject/corteza-server/compose/service/values"
"github.com/cortezaproject/corteza-server/pkg/payload"
"net/http"
"path"
"strings"
"github.com/titpetric/factory/resputil"
@@ -225,6 +226,9 @@ func (ctrl *Record) ImportInit(ctx context.Context, r *request.RecordImportInit)
return nil, err
} else if is {
ext = "jsonl"
} else {
// As last resort, use extension of the upload filename
ext = strings.TrimLeft(path.Ext(r.Upload.Filename), ".")
}
}