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

Add fallback to getting extension from filename #2118

Merged
merged 1 commit into from Sep 7, 2023

Conversation

j-piasecki
Copy link
Contributor

Thanks for submitting a PR! Please read these instructions carefully:

  • Explain the motivation for making this change.
  • Provide a test plan demonstrating that the code is solid.
  • Match the code formatting of the rest of the codebase.
  • Target the main branch, NOT a "stable" branch.

Motivation (required)

In some cases the getExtensionFromMimeType may return null, in which case the generated file would lack the extension. This PR adds fallback to rely on the extension when it happens.

Test Plan (required)

I wasn't able to make a reproducible example to showcase the problem, however, it emerged during the migration of the Expensify app to the new architecture. We've been using the patch for a while and didn't see any problems with it.

@Johan-dutoit
Copy link
Collaborator

@j-piasecki keen to update the PR to also grab the filename from the content resolver?

@Johan-dutoit Johan-dutoit added Enhancement Android Platform: Android labels Sep 5, 2023
@j-piasecki
Copy link
Contributor Author

@Johan-dutoit could you clarify what you mean? It already gets the filename via ContentResolver.query(...), no?

@Johan-dutoit
Copy link
Collaborator

Johan-dutoit commented Sep 7, 2023

Hah. @j-piasecki Apologies for not being clear. I was suggesting to use the filename from the ContentResolver.query(...) to the output (e.g. replacing the current String fileName = uri.getLastPathSegment(); with the value from ContentResolver.

@Johan-dutoit
Copy link
Collaborator

Actually, I'll make the change once this PR is merged. Thanks!

@Johan-dutoit Johan-dutoit merged commit 2c13085 into react-native-image-picker:main Sep 7, 2023
Johan-dutoit pushed a commit that referenced this pull request Sep 7, 2023
# [5.7.0](v5.6.1...v5.7.0) (2023-09-07)

### Features

* **filename:** add fallback to getting extension from filename ([#2118](#2118)) ([2c13085](2c13085))
@Johan-dutoit
Copy link
Collaborator

🎉 This PR is included in version 5.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants