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

Allow importing files with MIME type "application/octet-stream" #137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tom93
Copy link
Contributor

@tom93 tom93 commented Mar 16, 2024

Sometimes Android reports the MIME type as "application/octet-stream" even if the file has a .json extension (specifically, on Android 8 and 9 for backups exported outside the Download folder). Previously, such files could not be selected in the file picker when importing.

As a workaround, allow files with that MIME type.

@​devs: Should I also port this fix to the other apps that have a JSON import feature?

What is it?

  • Bugfix
  • Feature
  • Codebase improvement

Before/After Screenshots/Screen Record

No response

Fixes the following issue(s)

Acknowledgement

@tom93 tom93 mentioned this pull request Mar 16, 2024
7 tasks
Sometimes Android reports the MIME type as "application/octet-stream"
even if the file has a .json extension (specifically, on Android 8 and
9 for backups exported outside the Download folder). Previously, such
files could not be selected in the file picker when importing.

As a workaround, allow files with that MIME type.

Fixes FossifyOrg#88.
@tom93 tom93 force-pushed the fix-import-binary-mime-type branch from 79c9909 to b18e8aa Compare May 20, 2024 01:50
@naveensingh
Copy link
Member

@​devs: Should I also port this fix to the other apps that have a JSON import feature?

FossifyOrg/Notes#34 seems like a similar issue.

@@ -27,7 +27,7 @@ class SettingsActivity : SimpleActivity() {
private var blockedNumbersAtPause = -1
private var recycleBinMessages = 0
private val messagesFileType = "application/json"
private val messageImportFileTypes = listOf("application/json", "application/xml", "text/xml")
private val messageImportFileTypes = listOf("application/json", "application/xml", "text/xml", "application/octet-stream")
Copy link
Member

Choose a reason for hiding this comment

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

@tom93 why not do this at runtime for Android 8/9 only? That way, the behavior won't change on newer versions.

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.

Messages Import Export issue
2 participants