Merge branch 'master' into contactRetryDisconn
continuous-integration/drone/pr Build is pending Details

This commit is contained in:
Sarah Jamie Lewis 2022-12-14 18:51:46 +00:00
commit c946ff5574
1 changed files with 11 additions and 8 deletions

View File

@ -11,6 +11,7 @@ import (
"os"
path "path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"time"
@ -81,16 +82,18 @@ func (f *Functionality) DownloadFile(profile peer.CwtchPeer, conversationID int,
return errors.New("download path or manifest path is empty")
}
// Don't download files if the download file directory does not exist
if _, err := os.Stat(path.Dir(downloadFilePath)); os.IsNotExist(err) {
return errors.New("download directory does not exist")
}
// We write to a temp file for Android...
if runtime.GOOS != "android" {
// Don't download files if the download file directory does not exist
if _, err := os.Stat(path.Dir(downloadFilePath)); os.IsNotExist(err) {
return errors.New("download directory does not exist")
}
// Don't download files if the manifest file directory does not exist
if _, err := os.Stat(path.Dir(manifestFilePath)); os.IsNotExist(err) {
return errors.New("manifest directory does not exist")
// Don't download files if the manifest file directory does not exist
if _, err := os.Stat(path.Dir(manifestFilePath)); os.IsNotExist(err) {
return errors.New("manifest directory does not exist")
}
}
// Store local.filesharing.filekey.manifest as the location of the manifest
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key), manifestFilePath)