Compare commits

..

2 Commits

Author SHA1 Message Date
Seednode 3fd2bf6bb3 Inline single-use methods 2024-02-11 11:12:30 -06:00
Seednode 09bb2def7e Rename variable for conciseness 2024-02-11 10:30:10 -06:00
4 changed files with 9 additions and 17 deletions

View File

@ -23,18 +23,10 @@ func (filters *filters) hasIncludes() bool {
return len(filters.included) != 0 && Filtering return len(filters.included) != 0 && Filtering
} }
func (filters *filters) includes() string {
return strings.Join(filters.included, ",")
}
func (filters *filters) hasExcludes() bool { func (filters *filters) hasExcludes() bool {
return len(filters.excluded) != 0 && Filtering return len(filters.excluded) != 0 && Filtering
} }
func (filters *filters) excludes() string {
return strings.Join(filters.excluded, ",")
}
func (filters *filters) apply(fileList []string) []string { func (filters *filters) apply(fileList []string) []string {
result := make([]string, len(fileList)) result := make([]string, len(fileList))

View File

@ -75,13 +75,13 @@ func (index *fileIndex) List() []string {
func (index *fileIndex) remove(path string) { func (index *fileIndex) remove(path string) {
index.mutex.RLock() index.mutex.RLock()
tempIndex := make([]string, len(index.list)) t := make([]string, len(index.list))
copy(tempIndex, index.list) copy(t, index.list)
index.mutex.RUnlock() index.mutex.RUnlock()
var position int var position int
for k, v := range tempIndex { for k, v := range t {
if path == v { if path == v {
position = k position = k
@ -89,11 +89,11 @@ func (index *fileIndex) remove(path string) {
} }
} }
tempIndex[position] = tempIndex[len(tempIndex)-1] t[position] = t[len(t)-1]
index.mutex.Lock() index.mutex.Lock()
index.list = make([]string, len(tempIndex)-1) index.list = make([]string, len(t)-1)
copy(index.list, tempIndex[:len(tempIndex)-1]) copy(index.list, t[:len(t)-1])
index.mutex.Unlock() index.mutex.Unlock()
} }

View File

@ -17,7 +17,7 @@ import (
const ( const (
AllowedCharacters string = `^[A-z0-9.\-_]+$` AllowedCharacters string = `^[A-z0-9.\-_]+$`
ReleaseVersion string = "8.7.2" ReleaseVersion string = "8.7.4"
) )
var ( var (

View File

@ -47,12 +47,12 @@ func generateQueryParams(filters *filters, sortOrder, refreshInterval string) st
if Filtering { if Filtering {
queryParams.WriteString("include=") queryParams.WriteString("include=")
if filters.hasIncludes() { if filters.hasIncludes() {
queryParams.WriteString(filters.includes()) queryParams.WriteString(strings.Join(filters.included, ","))
} }
queryParams.WriteString("&exclude=") queryParams.WriteString("&exclude=")
if filters.hasExcludes() { if filters.hasExcludes() {
queryParams.WriteString(filters.excludes()) queryParams.WriteString(strings.Join(filters.excluded, ","))
} }
hasParams = true hasParams = true