fix(share-video) fix links not being trimmed (#9740)

This commit is contained in:
Avram Tudor 2021-08-18 12:09:04 +03:00 committed by GitHub
parent fbf9d489f0
commit 9914a5d14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -56,14 +56,20 @@ export default class AbstractSharedVideoDialog<S: *> extends Component < Props,
* @returns {boolean}
*/
_onSetVideoLink(link: string) {
if (!link || !link.trim()) {
if (!link) {
return false;
}
const youtubeId = getYoutubeId(link);
const trimmedLink = link.trim();
if (!trimmedLink) {
return false;
}
const youtubeId = getYoutubeId(trimmedLink);
const { onPostSubmit } = this.props;
onPostSubmit(youtubeId || link);
onPostSubmit(youtubeId || trimmedLink);
return true;
}