Skip to content

Commit 253d2ba

Browse files
committed
fix paths with leading slashes being interpreted as a url
1 parent c12755c commit 253d2ba

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM alpine:3.1
22

33
RUN apk add --update wget bash ca-certificates && \
4-
wget -O mockingjay-server https://github.com/quii/mockingjay-server/releases/download/1.11.0/linux_amd64_mockingjay-server --no-check-certificate && \
4+
wget -O mockingjay-server https://github.com/quii/mockingjay-server/releases/download/1.11.1/linux_amd64_mockingjay-server --no-check-certificate && \
55
chmod +x mockingjay-server && \
66
apk del wget bash && \
77
rm -rf /var/cache/apk/*

application.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"io"
1010
"log"
1111
"net/http"
12-
"net/url"
1312
"os"
1413
"time"
1514
)
@@ -41,15 +40,6 @@ type application struct {
4140
yamlMD5 [md5.Size]byte
4241
}
4342

44-
func isURL(toTest string) bool {
45-
_, err := url.ParseRequestURI(toTest)
46-
if err != nil {
47-
return false
48-
} else {
49-
return true
50-
}
51-
}
52-
5343
func defaultApplication(logger *log.Logger, httpTimeout time.Duration, configPath string) (app *application) {
5444
app = new(application)
5545
app.configPath = configPath

config_loaders.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"io"
66
"net/http"
7+
"net/url"
78
"os"
89
"path/filepath"
910
)
@@ -67,3 +68,8 @@ func (urlLoader) Load(uri string) ([]io.ReadCloser, []string, error) {
6768

6869
return []io.ReadCloser{res.Body}, []string{uri}, nil
6970
}
71+
72+
func isURL(x string) bool {
73+
u, err := url.Parse(x)
74+
return err == nil && u.Scheme != "" && u.Host != ""
75+
}

0 commit comments

Comments
 (0)