@@ -29,6 +29,7 @@ import (
29
29
"os"
30
30
"path"
31
31
"strconv"
32
+ "strings"
32
33
33
34
"github.com/emersion/go-webdav"
34
35
"gopkg.in/yaml.v3"
@@ -118,6 +119,11 @@ func (s *WebDavStorage) SetOptions(newOpts any) {
118
119
s .opt = * (newOpts .(* WebDavStorageOption ))
119
120
}
120
121
122
+ func webdavIsHTTPError (err error , code int ) bool {
123
+ expect := fmt .Sprintf ("%v %v" , code , http .StatusText (code ))
124
+ return strings .Contains (err .Error (), expect )
125
+ }
126
+
121
127
func (s * WebDavStorage ) Init (ctx context.Context ) (err error ) {
122
128
if alias := s .opt .Alias ; alias != "" {
123
129
user , ok := config .WebdavUsers [alias ]
@@ -152,8 +158,10 @@ func (s *WebDavStorage) Init(ctx context.Context) (err error) {
152
158
return
153
159
}
154
160
155
- if err = s .cli .Mkdir (ctx , "measure" ); err != nil {
156
- logErrorf ("Could not create measure folder for %s: %v" , s .String (), err )
161
+ if err := s .cli .Mkdir (ctx , "measure" ); err != nil {
162
+ if ! webdavIsHTTPError (err , http .StatusConflict ) {
163
+ logErrorf ("Could not create measure folder for %s: %v" , s .String (), err )
164
+ }
157
165
}
158
166
if s .opt .PreGenMeasures {
159
167
logInfo ("Creating measure files at %s" , s .String ())
0 commit comments