mirror of
https://github.com/pldubouilh/gossa.git
synced 2026-09-05 08:37:45 -04:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e9b85d4aa |
@@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.23.4
|
go-version: 1.23.0
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Run
|
- name: Run
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FLAGS := -trimpath -ldflags="-w -s"
|
FLAGS := -trimpath
|
||||||
NOCGO := CGO_ENABLED=0
|
NOCGO := CGO_ENABLED=0
|
||||||
|
|
||||||
build::
|
build::
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module github.com/pldubouilh/gossa
|
module github.com/pldubouilh/gossa
|
||||||
|
|
||||||
go 1.23.4
|
go 1.23.0
|
||||||
|
|||||||
@@ -100,8 +100,9 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
|
|||||||
p.Title = template.HTML(html.EscapeString(title))
|
p.Title = template.HTML(html.EscapeString(title))
|
||||||
|
|
||||||
for _, el := range files {
|
for _, el := range files {
|
||||||
info, err := el.Info()
|
info, errInfo := el.Info()
|
||||||
if err != nil {
|
el, err := os.Stat(fullPath + "/" + el.Name())
|
||||||
|
if err != nil || errInfo != nil {
|
||||||
log.Println("error - cant stat a file", err)
|
log.Println("error - cant stat a file", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -109,7 +110,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
|
|||||||
if *skipHidden && strings.HasPrefix(el.Name(), ".") {
|
if *skipHidden && strings.HasPrefix(el.Name(), ".") {
|
||||||
continue // dont print hidden files if we're not allowed
|
continue // dont print hidden files if we're not allowed
|
||||||
}
|
}
|
||||||
if *symlinks && info.Mode()&os.ModeSymlink != 0 {
|
if !*symlinks && info.Mode()&os.ModeSymlink != 0 {
|
||||||
continue // dont follow symlinks if we're not allowed
|
continue // dont follow symlinks if we're not allowed
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +127,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
|
|||||||
} else {
|
} else {
|
||||||
sl := strings.Split(name, ".")
|
sl := strings.Split(name, ".")
|
||||||
ext := strings.ToLower(sl[len(sl)-1])
|
ext := strings.ToLower(sl[len(sl)-1])
|
||||||
row := rowTemplate{name, template.URL(href), humanize(info.Size()), ext}
|
row := rowTemplate{name, template.URL(href), humanize(el.Size()), ext}
|
||||||
p.RowsFiles = append(p.RowsFiles, row)
|
p.RowsFiles = append(p.RowsFiles, row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
|
|||||||
hasListing := strings.Contains(body0, `readme.md`)
|
hasListing := strings.Contains(body0, `readme.md`)
|
||||||
body1 = get(t, url+"/support/readme.md")
|
body1 = get(t, url+"/support/readme.md")
|
||||||
hasReadme := strings.Contains(body1, `the master branch is automatically built and pushed`)
|
hasReadme := strings.Contains(body1, `the master branch is automatically built and pushed`)
|
||||||
|
body2 = get(t, url)
|
||||||
|
hasMainListing := strings.Contains(body2, `href="support">support/</a>`)
|
||||||
|
|
||||||
if !testExtra && hasReadme {
|
if !testExtra && hasReadme {
|
||||||
t.Fatal("error symlink file reached where illegal")
|
t.Fatal("error symlink file reached where illegal")
|
||||||
@@ -249,6 +251,11 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
|
|||||||
} else if testExtra && !hasListing {
|
} else if testExtra && !hasListing {
|
||||||
t.Fatal("error symlink folder unreachable")
|
t.Fatal("error symlink folder unreachable")
|
||||||
}
|
}
|
||||||
|
if !testExtra && hasMainListing {
|
||||||
|
t.Fatal("error symlink folder where illegal")
|
||||||
|
} else if testExtra && !hasMainListing {
|
||||||
|
t.Fatal("error symlink folder unreachable")
|
||||||
|
}
|
||||||
|
|
||||||
if testExtra {
|
if testExtra {
|
||||||
fmt.Println("\r\n~~~~~~~~~~ test symlink mkdir & cleanup")
|
fmt.Println("\r\n~~~~~~~~~~ test symlink mkdir & cleanup")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/library/golang:1.23.4-alpine AS builder
|
FROM docker.io/library/golang:1.23.0-alpine AS builder
|
||||||
RUN apk add --no-cache make
|
RUN apk add --no-cache make
|
||||||
WORKDIR /gossaSrc
|
WORKDIR /gossaSrc
|
||||||
COPY . /gossaSrc
|
COPY . /gossaSrc
|
||||||
|
|||||||
Reference in New Issue
Block a user