Skip to content

Commit 8f1ce1e

Browse files
committed
refactor(serverHandler/pathContext): use non-pointer type
1 parent 80aee20 commit 8f1ce1e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/serverHandler/pathContext.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type pathContext struct {
66
defaultSort string
77
}
88

9-
func (ctx *pathContext) QueryString() string {
9+
func (ctx pathContext) QueryString() string {
1010
// ?download&sort=x/
1111
buffer := make([]byte, 1, 18)
1212
buffer[0] = '?'
@@ -25,16 +25,16 @@ func (ctx *pathContext) QueryString() string {
2525
return string(buffer)
2626
}
2727

28-
func (ctx *pathContext) FileQueryString() string {
28+
func (ctx pathContext) FileQueryString() string {
2929
if ctx.download {
3030
return "?download"
3131
}
3232

3333
return ""
3434
}
3535

36-
func (ctx *pathContext) QueryStringOfSort(sort string) string {
37-
copiedCtx := *ctx
36+
func (ctx pathContext) QueryStringOfSort(sort string) string {
37+
copiedCtx := ctx
3838
copiedCtx.sort = &sort
3939
return copiedCtx.QueryString()
4040
}

src/serverHandler/responseData.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type responseData struct {
6767
SubItemsHtml []itemHtml
6868
SubItemPrefix string
6969
SortState SortState
70-
Context *pathContext
70+
Context pathContext
7171

7272
NeedDirSlashRedirect bool
7373

@@ -406,7 +406,7 @@ func (h *aliasHandler) getResponseData(r *http.Request) *responseData {
406406
canArchive := h.getCanArchive(subItems, rawReqPath, reqFsPath)
407407
canCors := h.getCanCors(rawReqPath, reqFsPath)
408408

409-
context := &pathContext{
409+
context := pathContext{
410410
download: isDownload,
411411
sort: rawSortBy,
412412
defaultSort: h.defaultSort,

0 commit comments

Comments
 (0)