9 Commits
5 changed files with 21 additions and 9 deletions
+6 -5
View File
@@ -2,25 +2,26 @@ version: 2
jobs:
lint:
docker:
- image: golangci/golangci-lint:v1.16
- image: golangci/golangci-lint:v1.30
steps:
- checkout
- run: golangci-lint run -v
build:
docker:
- image: circleci/golang:1.12
- image: circleci/golang:1.14
steps:
- checkout
- run: go build main.go
release:
docker:
- image: circleci/golang:1.12
machine: true
steps:
- checkout
- setup_remote_docker
- go/install
- run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- run: curl -sL https://git.io/goreleaser | bash
- run: docker logout
orbs:
go: circleci/go@1.14
workflows:
version: 2
build-workflow:
+1
View File
@@ -1,5 +1,6 @@
env:
- GO111MODULE=on
- CGO_ENABLED=0
before:
hooks:
+11 -2
View File
@@ -1,11 +1,20 @@
FROM alpine:latest as certs
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
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build /app/webdav /webdav
EXPOSE 80
COPY webdav /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)
[![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)
[![Docker Pulls](https://img.shields.io/docker/pulls/hacdias/webdav)](https://hub.docker.com/r/hacdias/webdav)
## 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.
//
// Get, when applied to collection, will return the same as PROPFIND method.
if r.Method == "GET" {
info, err := u.Handler.FileSystem.Stat(context.TODO(), r.URL.Path)
if r.Method == "GET" && strings.HasPrefix(r.URL.Path, u.Handler.Prefix) {
info, err := u.Handler.FileSystem.Stat(context.TODO(), strings.TrimPrefix(r.URL.Path, u.Handler.Prefix))
if err == nil && info.IsDir() {
r.Method = "PROPFIND"