func serveDownload(c *fb.Context, infos []os.FileInfo) error {
	name := ""
	if c.File != nil {
		name = c.File.Name
	}
	if name == "." || name == "" {
		name = "archive.zip"
	} else {
		name += ".zip"
	}
	c.RESP.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(name))
	return utils.ServeArchiveCompress(c.FilePaths, c.Config.FilesPath, c.RESP, infos)
}
set header as download, also set archive name, after archive
package web
import (
	"github.com/browsefile/backend/src/cnst"
	fb "github.com/browsefile/backend/src/lib"
	"github.com/browsefile/backend/src/lib/utils"
	"log"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
)
func downloadHandler(c *fb.Context) (code int, err error) {
	if len(c.FilePaths) <= 1 {
		if len(c.FilePaths) == 1 {
			c.URL = c.FilePaths[0]
		}
		c.URL = utils.SlashClean(c.URL)
		if len(c.URL) == 0 {
			return http.StatusBadRequest, cnst.ErrInvalidOption
		}
		c.File, err = c.MakeInfo()
		if err != nil {
			return cnst.ErrorToHTTP(err, false), err
		}
		if !c.File.IsDir {
			return downloadFileHandler(c)
		} else {
			c.FilePaths = []string{utils.CutUserPath(c.File.Path, c.Config.FilesPath)}
		}
	}
	code, err, infos := prepareFiles(c)
	if err != nil {
		log.Println(err)
		return code, err
	}
	err = serveDownload(c, infos)
	if err != nil {
		log.Println(err)
		code = http.StatusNotFound
	}
	return code, err
}
func prepareFiles(c *fb.Context) (int, error, []os.FileInfo) {
	var resultFiles = make([]string, 0, len(c.FilePaths))
	var resultInfos = make([]os.FileInfo, 0, len(c.FilePaths))
	var err error
	extUsr, _ := c.Config.GetUserByUsername(cnst.GUEST)
	extUsrMod := fb.ToUserModel(extUsr, c.Config)
	for _, p := range c.FilePaths {
		p = utils.SlashClean(p)
		c.URL = p
		if c.IsExternal {
			c.User = extUsrMod
		}
		c.File, err = c.MakeInfo()
		if err != nil {
			return cnst.ErrorToHTTP(err, false), err, nil
		}
		c.IsRecursive = c.File.IsDir
		infos, paths, err := c.File.GetListing(c)
		if err != nil {
			return cnst.ErrorToHTTP(err, false), err, nil
		}
		for i, inf := range infos {
			if !inf.IsDir() {
				resultFiles = append(resultFiles, paths[i])
				resultInfos = append(resultInfos, infos[i])
			}
		}
	}
	c.FilePaths = resultFiles
	return http.StatusOK, nil, resultInfos
}