mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
fix: empty folder in archive
This commit is contained in:
parent
36cacdf598
commit
7096b3dab9
24
http/raw.go
24
http/raw.go
@ -116,17 +116,19 @@ func addFile(ar archiver.Writer, d *data, path, commonPath string) error {
|
|||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
filename := strings.TrimPrefix(path, commonPath)
|
if path != commonPath {
|
||||||
filename = strings.TrimPrefix(filename, "/")
|
filename := strings.TrimPrefix(path, commonPath)
|
||||||
err = ar.Write(archiver.File{
|
filename = strings.TrimPrefix(filename, "/")
|
||||||
FileInfo: archiver.FileInfo{
|
err = ar.Write(archiver.File{
|
||||||
FileInfo: info,
|
FileInfo: archiver.FileInfo{
|
||||||
CustomName: filename,
|
FileInfo: info,
|
||||||
},
|
CustomName: filename,
|
||||||
ReadCloser: file,
|
},
|
||||||
})
|
ReadCloser: file,
|
||||||
if err != nil {
|
})
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
|
Loading…
Reference in New Issue
Block a user