Skip to content

Commit

Permalink
Bug webui search order (#253)
Browse files Browse the repository at this point in the history
* bugfix: Search order of webui directories was not deterministic

* bugfix: webui dir search order was not deterministic

* bugfix: webui dir search order was not deterministic

* bugfix: webui dir search order was not deterministic
  • Loading branch information
jamesread committed Mar 23, 2024
1 parent 1319f31 commit a8c4db1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/httpservers/webuiServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func findWebuiDir() string {
"/etc/OliveTin/webui/",
}

for _, dir := range directoriesToSearch {
// Use a classic i := 0 style for loop here instead of range, as the
// search order must be deterministic - the order that the slice was defined in.
for i := 0; i < len(directoriesToSearch); i++ {
dir := directoriesToSearch[i]

if _, err := os.Stat(dir); !os.IsNotExist(err) {
log.WithFields(log.Fields{
"dir": dir,
Expand Down

0 comments on commit a8c4db1

Please sign in to comment.