Lista conteudo de .zip, .tar, .tar.gz e .gz sem extrair, com limite anti-bomba.
This commit is contained in:
1 parent
dc829b9d43
commit
f6a74e1092
6 files changed
+389
-15
No files matched your search
@@ -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")
|
||||
|
||||
Reference in new issue
Block a user