Fix the issue with user not being able to send the video on Android#10467
Conversation
| let fileName = fileData.fileName || fileData.name || 'chat_attachment'; | ||
| const fileExtension = `.${_.last(fileData.type.split('/'))}`; | ||
| if (!Str.endsWith(fileName, fileExtension)) { | ||
| fileName = `${fileName}${fileExtension}`; |
There was a problem hiding this comment.
@eVoloshchak Can you please help me understand this
Why can't we always fileName = fileName + fileExtenstion ?
There was a problem hiding this comment.
@eVoloshchak Can you please help me understand this
Why can't we alwaysfileName = fileName + fileExtenstion?
Because this bug is present only on Android. On iOS files have their real name with an extension, so that would produce something like file-42.mp4.mp4
There was a problem hiding this comment.
Okay, makes sense.
I know that this is a really edge edge case -
I renamed a file to some-video.mp4.mp4.
On selecting this file, the attachment picker's header shows some-video.mp4.mp4.mp4
Platform: Android
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
Just realized that I didn't approve this PR 😅 |
|
Hi! Coming from #13938 where it's suspected this PR is for regression of the issue. This PR uses file type to determine the file extension, but for Thank you! |
Details
This issue happens due to react-native-image-picker returning a temporary file name instead of the real file name on Android. The back end cannot identify the file type and an error is returned. This fix checks if
fileNamehas an extension and if it doesn't, adds one from thefileData.type.Fixed Issues
$ #9422
Tests
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */displayNamepropertythisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesSTYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */displayNamepropertythisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)QA Steps
Screenshots
Web
Screen.Recording.2022-08-20.at.16.22.42.mov
Mobile Web
22-08-20-16-31-52.mp4
Desktop
Screen.Recording.2022-08-20.at.16.35.41.mov
iOS
Screen.Recording.2022-08-20.at.16.37.31.mov
Android
22-08-20-16-29-01.mp4