1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

Merge pull request #750 from schollz:schollz/issue574

Sending folders from the root of a drive always goes to the same path on the receiver's end
This commit is contained in:
Zack 2024-07-04 05:52:38 -07:00 committed by GitHub
commit 8577745d74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -421,8 +421,14 @@ func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool) (filesInfo []
if err != nil { if err != nil {
return err return err
} }
remoteFolder := strings.TrimPrefix(filepath.Dir(pathName), absPathWithSeparator := filepath.Dir(absPath)
filepath.Dir(absPath)+string(os.PathSeparator)) if !strings.HasSuffix(absPathWithSeparator, string(os.PathSeparator)) {
absPathWithSeparator += string(os.PathSeparator)
}
if strings.HasSuffix(absPathWithSeparator, string(os.PathSeparator)+string(os.PathSeparator)) {
absPathWithSeparator = strings.TrimSuffix(absPathWithSeparator, string(os.PathSeparator))
}
remoteFolder := strings.TrimPrefix(filepath.Dir(pathName), absPathWithSeparator)
if !info.IsDir() { if !info.IsDir() {
fInfo := FileInfo{ fInfo := FileInfo{
Name: info.Name(), Name: info.Name(),