Ensure folderPath ends with / for proper relative path calculation in ZIP downloads
This commit is contained in:
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
@@ -1881,13 +1881,15 @@ func downloadOrgFolderAsZip(w http.ResponseWriter, r *http.Request, db *database
|
||||
zipWriter := zip.NewWriter(w)
|
||||
defer zipWriter.Close()
|
||||
|
||||
// Ensure folderPath ends with / for proper relative path calculation
|
||||
if !strings.HasSuffix(folderPath, "/") {
|
||||
folderPath += "/"
|
||||
}
|
||||
|
||||
// Add each file to ZIP
|
||||
for _, file := range fileList {
|
||||
// Calculate relative path in ZIP
|
||||
relPath := strings.TrimPrefix(file.Path, folderPath)
|
||||
if relPath[0] == '/' {
|
||||
relPath = relPath[1:]
|
||||
}
|
||||
|
||||
// Download file from WebDAV
|
||||
remoteRel := strings.TrimPrefix(file.Path, "/")
|
||||
@@ -2035,13 +2037,15 @@ func downloadUserFolderAsZip(w http.ResponseWriter, r *http.Request, db *databas
|
||||
zipWriter := zip.NewWriter(w)
|
||||
defer zipWriter.Close()
|
||||
|
||||
// Ensure folderPath ends with / for proper relative path calculation
|
||||
if !strings.HasSuffix(folderPath, "/") {
|
||||
folderPath += "/"
|
||||
}
|
||||
|
||||
// Add each file to ZIP
|
||||
for _, file := range fileList {
|
||||
// Calculate relative path in ZIP
|
||||
relPath := strings.TrimPrefix(file.Path, folderPath)
|
||||
if relPath[0] == '/' {
|
||||
relPath = relPath[1:]
|
||||
}
|
||||
|
||||
// Download file from WebDAV
|
||||
remotePath := strings.TrimPrefix(file.Path, "/")
|
||||
|
||||
Reference in New Issue
Block a user