6 Commits

6 changed files with 29 additions and 9 deletions

View File

@@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
## [v0.11.2] - 2021-10-19
- Really fix the bug where too large attachments keep retrying
- Fix tests on Windows
## [v0.11.1] - 2021-10-11
- Improve logging and error handling
@@ -66,4 +71,4 @@ Add --exclude option to avoid uploading files in thumbnail directories
## [0.1.0] - 2017-02-16
Initial release
Initial release

View File

@@ -10,10 +10,14 @@ func TestNoConfig(t *testing.T) {
c := ConfigService{}
c.ConfigFilename = emptyTempFile()
os.Remove(c.ConfigFilename)
err := os.Remove(c.ConfigFilename)
if err != nil {
t.Fatalf("could not remove file: %v", err)
}
defer os.Remove(c.ConfigFilename) // because we are about to create it
err := c.LoadOrInit()
err = c.LoadOrInit()
if err != nil {
t.Errorf("unexpected failure from load: %s", err)
}
@@ -84,6 +88,7 @@ func emptyTempFile() string {
if err != nil {
panic(err)
}
f.Close()
return f.Name()
}

View File

@@ -80,7 +80,11 @@ func TestCheckPath(t *testing.T) {
if !w.checkPath() {
t.Error("checkPath failed?")
}
os.RemoveAll(dir)
err := os.RemoveAll(dir)
if err != nil {
t.Fatalf("could not remove test dir: %v", err)
}
if w.checkPath() {
t.Error("checkPath succeeded when shouldn't?")
}
@@ -91,9 +95,11 @@ func createFileTree() string {
if err != nil {
log.Fatal(err)
}
os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.gif"))
os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.jpg"))
os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.png"))
f1, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.gif"))
f2, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.jpg"))
f3, _ := os.Create(fmt.Sprintf("%s%c%s", dir, os.PathSeparator, "a.png"))
f1.Close()
f2.Close()
f3.Close()
return dir
}

View File

@@ -144,6 +144,7 @@ func (u *Upload) processUpload() error {
if resp.StatusCode == 413 {
// just fail immediately, we know this means the file was too big
daulog.SendLog("413 received - file too large", daulog.LogTypeError)
u.Failed = true
return errors.New("received 413 - file too large")
}

View File

@@ -66,4 +66,7 @@ func TestTooBigUpload(t *testing.T) {
} else if err.Error() != "received 413 - file too large" {
t.Errorf("wrong error occurred: %s", err.Error())
}
if u.Failed != true {
t.Error("upload should have been marked failed")
}
}

View File

@@ -7,7 +7,7 @@ import (
"golang.org/x/mod/semver"
)
const CurrentVersion string = "v0.11.1"
const CurrentVersion string = "v0.11.2"
func NewVersionAvailable(v string) bool {
if !semver.IsValid(CurrentVersion) {