feat(files): add archive content listing preview
ci / check (push) Successful in 1m12s

Lista conteudo de .zip, .tar, .tar.gz e .gz sem extrair, com limite anti-bomba.
This commit is contained in:
lgcosta committed 2026-11-06 09:55:56 -03:00
1 parent dc829b9d43
commit f6a74e1092
6 files changed
+389 -15

No files matched your search

+13
View File
@@ -55,6 +55,19 @@ func (s *Server) handleFileTree(w http.ResponseWriter, r *http.Request) {
})
}
// handleFileArchiveList devolve a listagem amigável do conteúdo de um
// compactado (.zip, .tar, .tar.gz/.tgz, .gz) sem extrair nada.
func (s *Server) handleFileArchiveList(w http.ResponseWriter, r *http.Request) {
entries, total, truncated, err := s.st.ListArchive(r.PathValue("id"))
if err != nil {
mapStoreErrorFor(w, err, "arquivo")
return
}
writeJSON(w, http.StatusOK, map[string]any{
"entries": entries, "total": total, "truncated": truncated,
})
}
func (s *Server) handleFileStatic(w http.ResponseWriter, r *http.Request) {
if err := s.st.ServeFile(w, r, r.PathValue("id")); err != nil {
mapStoreErrorFor(w, err, "arquivo")