mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: upload for product
This commit is contained in:
@@ -121,6 +121,15 @@ export const extractImageThumb = async(bufferOrFilePath: Readable | Buffer | str
|
||||
}
|
||||
}
|
||||
|
||||
export const encodeBase64EncodedStringForUpload = (b64: string) => (
|
||||
encodeURIComponent(
|
||||
b64
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/\=+$/, '')
|
||||
)
|
||||
)
|
||||
|
||||
export const generateProfilePicture = async(mediaUpload: WAMediaUpload) => {
|
||||
let bufferOrFilePath: Buffer | string
|
||||
if(Buffer.isBuffer(mediaUpload)) {
|
||||
@@ -501,6 +510,7 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger }: C
|
||||
}
|
||||
|
||||
const reqBody = Buffer.concat(chunks)
|
||||
fileEncSha256B64 = encodeBase64EncodedStringForUpload(fileEncSha256B64)
|
||||
|
||||
for(const { hostname, maxContentLengthBytes } of hosts) {
|
||||
logger.debug(`uploading to "${hostname}"`)
|
||||
|
||||
Reference in New Issue
Block a user