diff options
author | snu-ceyda <snu-ceyda@users.noreply.github.com> | 2020-07-09 14:56:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 23:56:15 -0600 |
commit | 735c86658d058512f5d86408e18e3c81c32788d1 (patch) | |
tree | 259d965d925288ba55d2ee75e9366dacbd2b5c8e /modules/caddyhttp/fileserver/browse.go | |
parent | a2dae1d43fcfb08a4b748302502874234d7d64af (diff) |
fileserver: Enable browse pagination with offset parameter (#3542)
* Update browse.go
* Update browselisting.go
* Update browsetpl.go
* fix linter err
* Update modules/caddyhttp/fileserver/browse.go
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
* Update modules/caddyhttp/fileserver/browselisting.go
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
* Update browsetpl.go
change from -> offset
* Update browse.go
* Update browselisting.go
Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Diffstat (limited to 'modules/caddyhttp/fileserver/browse.go')
-rw-r--r-- | modules/caddyhttp/fileserver/browse.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/caddyhttp/fileserver/browse.go b/modules/caddyhttp/fileserver/browse.go index e5e137f..3fecad9 100644 --- a/modules/caddyhttp/fileserver/browse.go +++ b/modules/caddyhttp/fileserver/browse.go @@ -106,6 +106,7 @@ func (fsrv *FileServer) browseApplyQueryParams(w http.ResponseWriter, r *http.Re sortParam := r.URL.Query().Get("sort") orderParam := r.URL.Query().Get("order") limitParam := r.URL.Query().Get("limit") + offsetParam := r.URL.Query().Get("offset") // first figure out what to sort by switch sortParam { @@ -130,7 +131,7 @@ func (fsrv *FileServer) browseApplyQueryParams(w http.ResponseWriter, r *http.Re } // finally, apply the sorting and limiting - listing.applySortAndLimit(sortParam, orderParam, limitParam) + listing.applySortAndLimit(sortParam, orderParam, limitParam, offsetParam) } func (fsrv *FileServer) browseWriteJSON(listing browseListing) (*bytes.Buffer, error) { |