Bug fix for lost avatars on profile update
Following a profile update, we need to reupload the avatar. Currently we're uploading the avatar by writing it to a temporary file and kicking off an NSURLSessionUploadTask. If Class A keys aren't available, we'd fail to complete the upload. This would remove the user's avatar from their profile.
This commit is contained in:
parent
f363ff4290
commit
378e58431f
@ -8,7 +8,7 @@ extension OWSSyncGroupsMessage {
|
||||
|
||||
@objc
|
||||
public func buildPlainTextAttachmentFile(transaction: SDSAnyReadTransaction) -> URL? {
|
||||
let fileUrl = OWSFileSystem.temporaryFileUrl()
|
||||
let fileUrl = OWSFileSystem.temporaryFileUrl(isAvailableWhileDeviceLocked: true)
|
||||
guard let outputStream = OutputStream(url: fileUrl, append: false) else {
|
||||
owsFailDebug("Could not open outputStream.")
|
||||
return nil
|
||||
|
||||
@ -676,7 +676,7 @@ public extension OWSUpload {
|
||||
|
||||
let cdn0UrlSession = signalService.urlSessionForCdn(cdnNumber: 0)
|
||||
return firstly { () -> Promise<HTTPResponse> in
|
||||
let dataFileUrl = OWSFileSystem.temporaryFileUrl()
|
||||
let dataFileUrl = OWSFileSystem.temporaryFileUrl(isAvailableWhileDeviceLocked: true)
|
||||
try data.write(to: dataFileUrl)
|
||||
|
||||
let request = try cdn0UrlSession.buildRequest(uploadUrlPath, method: .post)
|
||||
|
||||
@ -1311,7 +1311,7 @@ extension OWSURLSession {
|
||||
textParts textPartsDictionary: OrderedDictionary<String, String>,
|
||||
progress progressBlock: ProgressBlock? = nil) -> Promise<HTTPResponse> {
|
||||
do {
|
||||
let multipartBodyFileURL = OWSFileSystem.temporaryFileUrl()
|
||||
let multipartBodyFileURL = OWSFileSystem.temporaryFileUrl(isAvailableWhileDeviceLocked: true)
|
||||
let boundary = OWSMultipartBody.createMultipartFormBoundary()
|
||||
// Order of form parts matters.
|
||||
let textParts = textPartsDictionary.map { (key, value) in
|
||||
|
||||
@ -106,7 +106,7 @@ public class AudioWaveformManager: NSObject {
|
||||
// true and this path will no longer be hit.
|
||||
if !asset.isReadable, audioPath.hasSuffix("m4a") {
|
||||
|
||||
let symlinkPath = OWSFileSystem.temporaryFilePath(fileExtension: "aac")
|
||||
let symlinkPath = OWSFileSystem.temporaryFilePath(fileExtension: "aac", isAvailableWhileDeviceLocked: true)
|
||||
do {
|
||||
try FileManager.default.createSymbolicLink(atPath: symlinkPath,
|
||||
withDestinationPath: audioPath)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user