Merge pull request 'Fix non-image/preview downloads in Android' (#547) from android_file_download_fix into master
continuous-integration/drone/push Build is pending
Details
continuous-integration/drone/push Build is pending
Details
Reviewed-on: #547 Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
commit
9cb62d269e
|
@ -272,15 +272,21 @@ func (f *Functionality) DownloadFile(profile peer.CwtchPeer, conversationID int,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't download files if the download file directory does not exist
|
// Don't download files if the download file directory does not exist
|
||||||
if _, err := os.Stat(path.Dir(downloadFilePath)); os.IsNotExist(err) {
|
// Unless we are on Android where the kernel wishes to keep us ignorant of the
|
||||||
return errors.New("download directory does not exist")
|
// actual path and/or existence of the file. We handle this case further down
|
||||||
}
|
// the line when the manifest is received and protocol engine and the Android layer
|
||||||
|
// negotiate a temporary local file -> final file copy. We don't want to worry
|
||||||
|
// about that here...
|
||||||
|
if runtime.GOOS != "android" {
|
||||||
|
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
|
// Don't download files if the manifest file directory does not exist
|
||||||
if _, err := os.Stat(path.Dir(manifestFilePath)); os.IsNotExist(err) {
|
if _, err := os.Stat(path.Dir(manifestFilePath)); os.IsNotExist(err) {
|
||||||
return errors.New("manifest directory does not exist")
|
return errors.New("manifest directory does not exist")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store local.filesharing.filekey.manifest as the location of the manifest
|
// Store local.filesharing.filekey.manifest as the location of the manifest
|
||||||
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key), manifestFilePath)
|
profile.SetScopedZonedAttribute(attr.LocalScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", key), manifestFilePath)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue