Skip to content
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

Limit the size of the sending file #376

Merged
merged 6 commits into from
Mar 31, 2017
Merged

Limit the size of the sending file #376

merged 6 commits into from
Mar 31, 2017

Conversation

mukaiu
Copy link
Contributor

@mukaiu mukaiu commented Mar 30, 2017

Wechat web limits the file size to 20M

@coveralls
Copy link

coveralls commented Mar 30, 2017

Coverage Status

Changes Unknown when pulling 389af62 on mukaiu:limit_file_size into ** on Chatie:master**.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are very efficient, thanks!

@@ -353,6 353,10 @@ export class PuppetWeb extends Puppet {
}))
})

let fileMaxSize = 20 * 1024 * 1024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Should be const instead of let.
  2. Could you link to the size limit code line in wxwebapp(we have a track tool named webwxapp-tracker
    )? So we could track it in the future.

@@ -353,6 353,10 @@ export class PuppetWeb extends Puppet {
}))
})

let fileMaxSize = 20 * 1024 * 1024
if (buffer.length > fileMaxSize)
throw new Error('Maximum file size 20M')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20M should be calculated here instead of hard coded.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 0f74cbe on mukaiu:limit_file_size into ** on Chatie:master**.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 0f74cbe on mukaiu:limit_file_size into ** on Chatie:master**.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@@ -353,6 353,12 @@ export class PuppetWeb extends Puppet {
}))
})

// Sending video files is not allowed to exceed 20MB
// https://github.com/Chatie/webwx-app-tracker/blob/master/formatted/webwxApp.js#L1115
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the link with a specific commit hash number instead of the latest, because what we want to track is a specific version.

like this: https://github.com/Chatie/webwx-app-tracker/blob/7c59d35c6ea0cff38426a4c5c912a086c4c512b2/formatted/webwxApp.js#L1115

// https://github.com/Chatie/webwx-app-tracker/blob/master/formatted/webwxApp.js#L1115
const videoMaxSize = 20 * 1024 * 1024
if (mediatype === 'video' && buffer.length > videoMaxSize)
throw new Error('Sending video files is not allowed to exceed 20MB')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new Error('Sending video files is not allowed to exceed ' videoMaxSize/1024/1024 'MB')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using

`Sending video files is not allowed to exceed ${videoMaxSize/1024/1024}MB`

@mukaiu
Copy link
Contributor Author

mukaiu commented Mar 31, 2017

My code details need to be optimized😄😄😄

@huan
Copy link
Member

huan commented Mar 31, 2017

Great, thanks!

@huan huan merged commit a59984e into wechaty:master Mar 31, 2017
@mukaiu mukaiu deleted the limit_file_size branch March 31, 2017 06:49
@mukaiu mukaiu restored the limit_file_size branch March 31, 2017 06:49
huan pushed a commit that referenced this pull request Mar 31, 2017
* fix Upcase

* use .alias() instead of .remark() 

contact.remark() should be deprecated

* fix Upcase

* use .alias() instead of .remark() 

contact.remark() should be deprecated

* fix the embeded doc for .alias()

* fix trailing whitespace

* Limit the size of the sending file (#376)

* Limit the size of the sending file

* limit vedio size

* add remark

* tslint

* Optimize videoMaxSize limit

* tslint

* fix Upcase

* use .alias() instead of .remark() 

contact.remark() should be deprecated

* fix the embeded doc for .alias()

* fix trailing whitespace

* remove  unnecessary comments in the exmaple code

* better example code

* Set / Get / Delete => SET / GET /DELETE

* better delete alias example

* Revert "Limit the size of the sending file (#376)"

This reverts commit a59984e.
@mukaiu mukaiu deleted the limit_file_size branch April 5, 2017 15:17
@mukaiu mukaiu restored the limit_file_size branch April 19, 2017 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants