"slice bounds out of range" when username not specified for webdav backend

Please describe what you are doing to trigger the bug:

duplicacy add yandex test webdav://webdav.yandex.com//duplicacy-test

Please describe what you expect to happen (but doesn’t):
Error message saying that valid “username” is required.

Please describe what actually happens (the wrong behaviour):

runtime error: slice bounds out of range
goroutine 1 [running]:
runtime/debug.Stack(0x29, 0x0, 0x0)
	/opt/local/lib/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
	/opt/local/lib/go/src/runtime/debug/stack.go:16 +0x22
github.com/gilbertchen/duplicacy/src.CatchLogException()
	../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_log.go:183 +0xf1
panic(0x499bee0, 0x52fcae0)
	/opt/local/lib/go/src/runtime/panic.go:513 +0x1b9
github.com/gilbertchen/duplicacy/src.CreateStorage(0x7ffeefbff896, 0x6, 0x7ffeefbff89d, 0x4, 0x0, 0x0, 0x7ffeefbff8a2, 0x2a, 0x0, 0x0, ...)
	../go/src/github.com/gilbertchen/duplicacy/src/duplicacy_storage.go:629 +0x459c
main.configRepository(0xc000183d40, 0xc000183d00)
	../go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:317 +0x5a9
main.addStorage(0xc000183d40)
	../go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:216 +0x30
github.com/gilbertchen/cli.Command.Run(0x4ad8b75, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4b0fdfe, 0x40, 0x0, ...)
	../go/src/github.com/gilbertchen/cli/command.go:160 +0x783
github.com/gilbertchen/cli.(*App).Run(0xc000183b00, 0xc0000e2000, 0x5, 0x5, 0x0, 0x0)
	../go/src/github.com/gilbertchen/cli/app.go:179 +0x651
main.main()
	../go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:2006 +0x54be

Here:

    } else if matched[1] == "webdav" || matched[1] == "webdav-http" {
            server := matched[3]
            username := matched[2]
 --->       username = username[:len(username)-1]
            storageDir := matched[5]
            port := 0
            useHTTP := matched[1] == "webdav-http"

Helping with the link to the source:

2 Likes