Skip to content

Commit

Permalink
feat: Don't print path on share
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Aug 10, 2022
1 parent 61c6319 commit b352beb
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions pkg/crud/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,22 @@ func (a App) stats(w http.ResponseWriter, r *http.Request, request provider.Requ
return renderer.NewPage("", http.StatusInternalServerError, nil), err
}

entries := []entry{
{Key: "Directories", Value: stats["Directories"]},
{Key: "Files", Value: stats["Files"]},
{Key: "Size", Value: bytesHuman(stats["Size"])},
{Key: "Metadatas", Value: fmt.Sprintf("%s (%.1f%% of Size)", bytesHuman(stats["Metadatas"]), float64(stats["Metadatas"]*100)/float64(stats["Size"]))},
}

if request.Share.IsZero() {
entries = append(entries, entry{Key: "Current path", Value: pathname})
}

return renderer.NewPage("stats", http.StatusOK, map[string]any{
"Paths": getPathParts(request),
"Request": request,
"Message": message,
"Stats": []entry{
{Key: "Current path", Value: pathname},
{Key: "Directories", Value: stats["Directories"]},
{Key: "Files", Value: stats["Files"]},
{Key: "Size", Value: bytesHuman(stats["Size"])},
{Key: "Metadatas", Value: fmt.Sprintf("%s (%.1f%% of Size)", bytesHuman(stats["Metadatas"]), float64(stats["Metadatas"]*100)/float64(stats["Size"]))},
},
"Stats": entries,
}), nil
}

Expand Down

0 comments on commit b352beb

Please sign in to comment.