Skip to content

Conversation

oneleo
Copy link

@oneleo oneleo commented Dec 6, 2020

Can archive all (root) files and download it by one click. #100
增加一鍵打包根目錄鈕

Can archive all (root) files and download it by one click.
@@ -92,6 +95,10 @@ func CompressToZip(w http.ResponseWriter, rootDir string) {

filepath.Walk(rootDir, func(path string, info os.FileInfo, err error) error {
zipPath := path[len(rootDir):]
if rootDir == "." {
zipPath = path[len(rootDir)-1:]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以直接简写成这样吧
zipPath = path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants