-
Notifications
You must be signed in to change notification settings - Fork 3k
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 the issue with user not being able to send the video on Android #10467
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eVoloshchak Can you please help me understand this
Why can't we always fileName = fileName + fileExtenstion
?
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
fileName
has an extension and if it doesn't, adds one from thefileData.type
.Fixed Issues
$ #9422
Tests
PR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is 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 Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is 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