Skip to content

Commit

Permalink
initial import of gowebdav fork to support custom properties (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Dec 1, 2023
1 parent 837d228 commit f40fd83
Show file tree
Hide file tree
Showing 21 changed files with 3,609 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/sync/webdav.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package sync

import (
"github.com/openziti/zrok/util/sync/webdavClient"
"github.com/pkg/errors"
"github.com/studio-b12/gowebdav"
"io"
"os"
"path/filepath"
Expand All @@ -16,11 +16,11 @@ type WebDAVTargetConfig struct {
}

type WebDAVTarget struct {
c *gowebdav.Client
c *webdavClient.Client
}

func NewWebDAVTarget(cfg *WebDAVTargetConfig) (*WebDAVTarget, error) {
c := gowebdav.NewClient(cfg.URL, cfg.Username, cfg.Password)
c := webdavClient.NewClient(cfg.URL, cfg.Username, cfg.Password)
if err := c.Connect(); err != nil {
return nil, errors.Wrap(err, "error connecting to webdav target")
}
Expand Down Expand Up @@ -48,7 +48,7 @@ func (t *WebDAVTarget) recurse(path string, tree []*Object) ([]*Object, error) {
return nil, err
}
} else {
if v, ok := f.(gowebdav.File); ok {
if v, ok := f.(webdavClient.File); ok {
tree = append(tree, &Object{
Path: filepath.ToSlash(filepath.Join(path, f.Name())),
Size: v.Size(),
Expand Down
27 changes: 27 additions & 0 deletions util/sync/webdavClient/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Copyright (c) 2014, Studio B12 GmbH
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 changes: 42 additions & 0 deletions util/sync/webdavClient/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
BIN := gowebdav
SRC := $(wildcard *.go) cmd/gowebdav/main.go

all: test cmd

cmd: ${BIN}

${BIN}: ${SRC}
go build -o $@ ./cmd/gowebdav

test:
go test -modfile=go_test.mod -v -short -cover ./...

api: .go/bin/godoc2md
@sed '/^## API$$/,$$d' -i README.md
@echo '## API' >> README.md
@$< github.com/studio-b12/gowebdav | sed '/^$$/N;/^\n$$/D' |\
sed '2d' |\
sed 's/\/src\/github.com\/studio-b12\/gowebdav\//https:\/\/github.com\/studio-b12\/gowebdav\/blob\/master\//g' |\
sed 's/\/src\/target\//https:\/\/github.com\/studio-b12\/gowebdav\/blob\/master\//g' |\
sed 's/^#/##/g' >> README.md

check: .go/bin/gocyclo
gofmt -w -s $(SRC)
@echo
.go/bin/gocyclo -over 15 .
@echo
go vet -modfile=go_test.mod ./...


.go/bin/godoc2md:
@mkdir -p $(@D)
@GOPATH="$(CURDIR)/.go" go install github.com/davecheney/godoc2md@latest

.go/bin/gocyclo:
@mkdir -p $(@D)
@GOPATH="$(CURDIR)/.go" go install github.com/fzipp/gocyclo/cmd/gocyclo@latest

clean:
@rm -f ${BIN}

.PHONY: all cmd clean test api check
Loading

0 comments on commit f40fd83

Please sign in to comment.