Skip to content

Commit 74f02d5

Browse files
committed
refactor: rename path-values type data prop to values
1 parent 31297ac commit 74f02d5

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/serverHandler/header.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ func (h *aliasHandler) getHeaders(reqUrlPath, reqFsPath string, doGetHeaders boo
4343

4444
for i := range h.headersUrls {
4545
if util.HasUrlPrefixDir(reqUrlPath, h.headersUrls[i].path) {
46-
headers = append(headers, h.headersUrls[i].headers...)
46+
headers = append(headers, h.headersUrls[i].values...)
4747
}
4848
}
4949

5050
for i := range h.headersDirs {
5151
if util.HasFsPrefixDir(reqFsPath, h.headersDirs[i].path) {
52-
headers = append(headers, h.headersDirs[i].headers...)
52+
headers = append(headers, h.headersDirs[i].values...)
5353
}
5454
}
5555

src/serverHandler/pathValues.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ type prefixFilter func(whole, prefix string) bool
77
// pathInts
88

99
type pathInts struct {
10-
path string
11-
ints []int
10+
path string
11+
values []int
1212
}
1313

1414
type pathIntsList []pathInts
@@ -25,7 +25,7 @@ func (list pathIntsList) mergePrefixMatched(mergeWith []int, matchPrefix prefixF
2525
if result == nil {
2626
result = []int{}
2727
}
28-
result = append(result, list[i].ints...)
28+
result = append(result, list[i].values...)
2929
}
3030
}
3131

@@ -58,8 +58,8 @@ func (list pathIntsList) filterSuccessor(includeSelf bool, matchPrefix prefixFil
5858
// pathStrings
5959

6060
type pathStrings struct {
61-
path string
62-
strings []string
61+
path string
62+
values []string
6363
}
6464

6565
type pathStringsList []pathStrings
@@ -76,7 +76,7 @@ func (list pathStringsList) mergePrefixMatched(mergeWith []string, matchPrefix p
7676
if result == nil {
7777
result = []string{}
7878
}
79-
result = append(result, list[i].strings...)
79+
result = append(result, list[i].values...)
8080
}
8181
}
8282

@@ -109,8 +109,8 @@ func (list pathStringsList) filterSuccessor(includeSelf bool, matchPrefix prefix
109109
// pathHeaders
110110

111111
type pathHeaders struct {
112-
path string
113-
headers [][2]string
112+
path string
113+
values [][2]string
114114
}
115115

116116
type pathHeadersList []pathHeaders
@@ -127,7 +127,7 @@ func (list pathHeadersList) mergePrefixMatched(mergeWith [][2]string, matchPrefi
127127
if result == nil {
128128
result = [][2]string{}
129129
}
130-
result = append(result, list[i].headers...)
130+
result = append(result, list[i].values...)
131131
}
132132
}
133133

src/serverHandler/perm.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func hasUrlOrDirPrefixUsers(urlsUsers pathIntsList, reqUrl string, dirsUsers pat
3030
if userId < 0 {
3131
continue
3232
}
33-
for _, uid := range urlsUsers[i].ints {
33+
for _, uid := range urlsUsers[i].values {
3434
if uid == userId {
3535
match = true
3636
return
@@ -46,7 +46,7 @@ func hasUrlOrDirPrefixUsers(urlsUsers pathIntsList, reqUrl string, dirsUsers pat
4646
if userId < 0 {
4747
continue
4848
}
49-
for _, uid := range dirsUsers[i].ints {
49+
for _, uid := range dirsUsers[i].values {
5050
if uid == userId {
5151
match = true
5252
return

src/serverHandler/restrictAccess.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"strings"
88
)
99

10-
func newRestrictAccesses(pathHostsList [][]string) []pathStrings {
11-
restricts := make([]pathStrings, 0, len(pathHostsList))
10+
func newRestrictAccesses(pathHostsList [][]string) pathStringsList {
11+
restricts := make(pathStringsList, 0, len(pathHostsList))
1212

1313
for _, pathHosts := range pathHostsList {
1414
if len(pathHosts) == 0 {
@@ -51,7 +51,7 @@ func (h *aliasHandler) isAllowAccess(r *http.Request, reqUrlPath, reqFsPath stri
5151
continue
5252
}
5353
urlMatched = true
54-
if util.Contains(h.restrictAccessUrls[i].strings, sourceHost) {
54+
if util.Contains(h.restrictAccessUrls[i].values, sourceHost) {
5555
return true, true
5656
}
5757
}
@@ -62,7 +62,7 @@ func (h *aliasHandler) isAllowAccess(r *http.Request, reqUrlPath, reqFsPath stri
6262
continue
6363
}
6464
dirMatched = true
65-
if util.Contains(h.restrictAccessDirs[i].strings, sourceHost) {
65+
if util.Contains(h.restrictAccessDirs[i].values, sourceHost) {
6666
return true, true
6767
}
6868
}

src/serverHandler/util.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ func pathUsernamesToPathUids(users *user.List, pathsUsernames [][]string) pathIn
1717
continue
1818
}
1919
pathIds := pathInts{
20-
path: pathUsernames[0],
21-
ints: make([]int, 0, len(pathUsernames)-1),
20+
path: pathUsernames[0],
21+
values: make([]int, 0, len(pathUsernames)-1),
2222
}
2323
for _, username := range pathUsernames[1:] {
2424
uid := users.FindIndex(username)
2525
if uid >= 0 {
26-
pathIds.ints = append(pathIds.ints, uid)
26+
pathIds.values = append(pathIds.values, uid)
2727
}
2828
}
2929
list = append(list, pathIds)

0 commit comments

Comments
 (0)