From d9bf8ab6ccf7806ed72d76e9e1709600b33f38d6 Mon Sep 17 00:00:00 2001 From: Rob Loranger Date: Mon, 26 Aug 2019 14:53:05 -0700 Subject: [PATCH] update to wfimport v0.2.0 now checking for and returning invalid content type errors --- account_import.go | 4 ++++ go.mod | 2 +- go.sum | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/account_import.go b/account_import.go index 6e6cea5..88a9a91 100644 --- a/account_import.go +++ b/account_import.go @@ -95,6 +95,10 @@ func handleImport(app *App, u *User, w http.ResponseWriter, r *http.Request) err // not a real error so don't log _ = addSessionFlash(app, w, r, fmt.Sprintf("%s was empty, import skipped", formFile.Filename), nil) continue + } else if err == wfimport.ErrInvalidContentType { + // same as above + _ = addSessionFlash(app, w, r, fmt.Sprintf("%s is not a supported post file", formFile.Filename), nil) + continue } else if err != nil { fileErrs = append(fileErrs, fmt.Errorf("failed to read copy of %s", formFile.Filename)) log.Error("import textfile: file to post: %v", err) diff --git a/go.mod b/go.mod index f1b7733..0d7d865 100644 --- a/go.mod +++ b/go.mod @@ -57,7 +57,7 @@ require ( github.com/writeas/go-webfinger v0.0.0-20190106002315-85cf805c86d2 github.com/writeas/httpsig v1.0.0 github.com/writeas/impart v1.1.0 - github.com/writeas/import v0.1.1 + github.com/writeas/import v0.2.0 github.com/writeas/monday v0.0.0-20181024183321-54a7dd579219 github.com/writeas/nerds v1.0.0 github.com/writeas/openssl-go v1.0.0 // indirect diff --git a/go.sum b/go.sum index 1805e66..de39ce4 100644 --- a/go.sum +++ b/go.sum @@ -171,6 +171,8 @@ github.com/writeas/import v0.0.0-20190815235139-628d10daaa9e h1:31PkvDTWkjzC1nGz github.com/writeas/import v0.0.0-20190815235139-628d10daaa9e/go.mod h1:f3K8z7YnJwKnPIT4h7980n9C6cQb4DIB2QcxVCTB7lE= github.com/writeas/import v0.1.1 h1:SbYltT+nxrJBUe0xQWJqeKMHaupbxV0a6K3RtwcE4yY= github.com/writeas/import v0.1.1/go.mod h1:gFe0Pl7ZWYiXbI0TJxeMMyylPGZmhVvCfQxhMEc8CxM= +github.com/writeas/import v0.2.0 h1:Ov23JW9Rnjxk06rki1Spar45bNX647HhwhAZj3flJiY= +github.com/writeas/import v0.2.0/go.mod h1:gFe0Pl7ZWYiXbI0TJxeMMyylPGZmhVvCfQxhMEc8CxM= github.com/writeas/monday v0.0.0-20181024183321-54a7dd579219 h1:baEp0631C8sT2r/hqwypIw2snCFZa6h7U6TojoLHu/c= github.com/writeas/monday v0.0.0-20181024183321-54a7dd579219/go.mod h1:NyM35ayknT7lzO6O/1JpfgGyv+0W9Z9q7aE0J8bXxfQ= github.com/writeas/nerds v1.0.0 h1:ZzRcCN+Sr3MWID7o/x1cr1ZbLvdpej9Y1/Ho+JKlqxo=