-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug that can't send file. #106
Conversation
Change WebMediaType 1 -> pic 2 -> video 4 -> doc and deprecate Audio.
Fix the bug If the file.size > 1M, the uploadMedia() function will run error. Split the buffer, and then uploadFile one by one.
apply to ESLint
Simplify the logic code.
src/puppet-puppeteer.ts
Outdated
} | ||
// use promise.all() make the former upload of this buffer quickly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could do something like this here to get the last one:
const lastBuffer = bufferData.pop()
await Promise.all(bufferData.map(getMediaId))
const mediaId = await getMediaId(lastBuffer, bufferData.length)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/puppet-puppeteer.ts
Outdated
await Promise.all(funcList) | ||
const lastOne = bufferData.length - 1 | ||
mediaId = await getMediaId(bufferData[lastOne], lastOne) | ||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to catch the error and log it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
1. graceful code 2. catch error log
upload media by order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the fix! Approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@su-chang @windmemory Thank you very much for the PR and the review! This bug had been a while and many developers will be benefited from your fix.
According to your code, it seems the most important part is to change the 1
to 'pic'
, 2
to 'video'
, etc.
Could you please add a link to the webwx-app code so that we could be able to make it clear, and make sure we are on the right direction.
The code can be linked from webwx-app-tracker repository from https://github.com/Chatie/webwx-app-tracker/blob/master/formatted/webwxApp.js.
It would be wonderful if you can also add the exact change commit that made this breaking change. You can find all the webwx-app changes from https://github.com/Chatie/webwx-app-tracker/commits/master
I'll merge this PR and make it published so that the community could test it after you finished adding the related links from the webwxApp.js and the commits.
Again, thank you very for the effects to make this puppet better, you did a great job!
@huan It means that: r.MSGTYPE_IMAGE: n = "pic";
r.MSGTYPE_VIDEO: n = "video";
default: n = "doc" and then
About This commit be committed on 19 Nov 2018, but the problem BTW, I find Thx for ur reading. |
I think the verification is on the server side, and during the debug phase, we saw that using different |
@su-chang Thank you very much for the additional information and they are very valuable. I'll merge this PR for now, and it would be fantastic if we could refactor it to use the Good work! |
This PR should be published on v0.17.23 or later version. |
Fix the bug that can't send file. #91