Compare commits

..
9 Commits
5 changed files with 21 additions and 9 deletions
+6 -5
View File
@@ -2,25 +2,26 @@ version: 2
jobs: jobs:
lint: lint:
docker: docker:
- image: golangci/golangci-lint:v1.16 - image: golangci/golangci-lint:v1.30
steps: steps:
- checkout - checkout
- run: golangci-lint run -v - run: golangci-lint run -v
build: build:
docker: docker:
- image: circleci/golang:1.12 - image: circleci/golang:1.14
steps: steps:
- checkout - checkout
- run: go build main.go - run: go build main.go
release: release:
docker: machine: true
- image: circleci/golang:1.12
steps: steps:
- checkout - checkout
- setup_remote_docker - go/install
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD - run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- run: curl -sL https://git.io/goreleaser | bash - run: curl -sL https://git.io/goreleaser | bash
- run: docker logout - run: docker logout
orbs:
go: circleci/[email protected]
workflows: workflows:
version: 2 version: 2
build-workflow: build-workflow:
+1
View File
@@ -1,5 +1,6 @@
env: env:
- GO111MODULE=on - GO111MODULE=on
- CGO_ENABLED=0
before: before:
hooks: hooks:
+11 -2
View File
@@ -1,11 +1,20 @@
FROM alpine:latest as certs FROM alpine:latest as certs
RUN apk --update add ca-certificates RUN apk --update add ca-certificates
FROM golang:alpine as build
WORKDIR /app/
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN go build -v
FROM scratch FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /app/webdav /webdav
EXPOSE 80 EXPOSE 80
COPY webdav /webdav
ENTRYPOINT [ "/webdav" ] ENTRYPOINT [ "/webdav" ]
+1
View File
@@ -3,6 +3,7 @@
[![Build](https://img.shields.io/circleci/project/github/hacdias/webdav/master.svg?style=flat-square)](https://circleci.com/gh/hacdias/webdav) [![Build](https://img.shields.io/circleci/project/github/hacdias/webdav/master.svg?style=flat-square)](https://circleci.com/gh/hacdias/webdav)
[![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/webdav?style=flat-square)](https://goreportcard.com/report/hacdias/webdav) [![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/webdav?style=flat-square)](https://goreportcard.com/report/hacdias/webdav)
[![Version](https://img.shields.io/github/release/hacdias/webdav.svg?style=flat-square)](https://github.com/hacdias/webdav/releases/latest) [![Version](https://img.shields.io/github/release/hacdias/webdav.svg?style=flat-square)](https://github.com/hacdias/webdav/releases/latest)
[![Docker Pulls](https://img.shields.io/docker/pulls/hacdias/webdav)](https://hub.docker.com/r/hacdias/webdav)
## Install ## Install
+2 -2
View File
@@ -127,8 +127,8 @@ func (c *Config) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// the collection, or something else altogether. // the collection, or something else altogether.
// //
// Get, when applied to collection, will return the same as PROPFIND method. // Get, when applied to collection, will return the same as PROPFIND method.
if r.Method == "GET" { if r.Method == "GET" && strings.HasPrefix(r.URL.Path, u.Handler.Prefix) {
info, err := u.Handler.FileSystem.Stat(context.TODO(), r.URL.Path) info, err := u.Handler.FileSystem.Stat(context.TODO(), strings.TrimPrefix(r.URL.Path, u.Handler.Prefix))
if err == nil && info.IsDir() { if err == nil && info.IsDir() {
r.Method = "PROPFIND" r.Method = "PROPFIND"