Restart input stream on retried request
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
parent
87f7203141
commit
45425c158d
2 changed files with 5 additions and 5 deletions
|
@ -169,7 +169,7 @@ type PromiseAjaxOptionsType = {
|
||||||
basicAuth?: string;
|
basicAuth?: string;
|
||||||
certificateAuthority?: string;
|
certificateAuthority?: string;
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
data?: Uint8Array | Readable | string;
|
data?: Uint8Array | (() => Readable) | string;
|
||||||
disableRetries?: boolean;
|
disableRetries?: boolean;
|
||||||
disableSessionResumption?: boolean;
|
disableSessionResumption?: boolean;
|
||||||
headers?: HeaderListType;
|
headers?: HeaderListType;
|
||||||
|
@ -299,7 +299,7 @@ async function getFetchOptions(
|
||||||
|
|
||||||
const fetchOptions = {
|
const fetchOptions = {
|
||||||
method: options.type,
|
method: options.type,
|
||||||
body: options.data,
|
body: typeof options.data === 'function' ? options.data() : options.data,
|
||||||
headers: {
|
headers: {
|
||||||
'User-Agent': getUserAgent(options.version),
|
'User-Agent': getUserAgent(options.version),
|
||||||
'X-Signal-Agent': 'OWD',
|
'X-Signal-Agent': 'OWD',
|
||||||
|
@ -1303,7 +1303,7 @@ export type WebAPIType = {
|
||||||
elements: VerifyServiceIdRequestType
|
elements: VerifyServiceIdRequestType
|
||||||
) => Promise<VerifyServiceIdResponseType>;
|
) => Promise<VerifyServiceIdResponseType>;
|
||||||
putEncryptedAttachment: (
|
putEncryptedAttachment: (
|
||||||
encryptedBin: Uint8Array | Readable,
|
encryptedBin: Uint8Array | (() => Readable),
|
||||||
uploadForm: AttachmentV3ResponseType
|
uploadForm: AttachmentV3ResponseType
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
putProfile: (
|
putProfile: (
|
||||||
|
@ -3530,7 +3530,7 @@ export function initialize({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function putEncryptedAttachment(
|
async function putEncryptedAttachment(
|
||||||
encryptedBin: Uint8Array | Readable,
|
encryptedBin: Uint8Array | (() => Readable),
|
||||||
uploadForm: AttachmentV3ResponseType
|
uploadForm: AttachmentV3ResponseType
|
||||||
) {
|
) {
|
||||||
const { signedUploadLocation, headers } = uploadForm;
|
const { signedUploadLocation, headers } = uploadForm;
|
||||||
|
|
|
@ -146,7 +146,7 @@ export async function uploadFile({
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await server.putEncryptedAttachment(
|
await server.putEncryptedAttachment(
|
||||||
createReadStream(absoluteCiphertextPath),
|
() => createReadStream(absoluteCiphertextPath),
|
||||||
uploadForm
|
uploadForm
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue