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

Error when sharing a file with name starting with "Con" #526

Open
massimobio opened this issue Feb 2, 2024 · 0 comments
Open

Error when sharing a file with name starting with "Con" #526

massimobio opened this issue Feb 2, 2024 · 0 comments
Labels
bug Default bug tag for tracking triage-needed For issues raised to be triaged and prioritized by internal Microsoft teams

Comments

@massimobio
Copy link

Steps to reproduce

I can share files in PDF, XML, WAV and other formats from my app and it all works correctly except when the name of the file starts with the letters "Con", in which case I get the error:
Screenshot 2024-02-02 170708

For example, sharing Connection.pdf fails while sharing Comnection.pdf works and the file appears in the Windows Downloads folder.
100% reproducible on various Windows machines. Only affects Windows. Android devices work as expected.

My share code:

        fun share(context: Context, uri: Uri, type: String, title: String) {
            val shareIntent = Intent(Intent.ACTION_SEND)
            shareIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
            shareIntent.putExtra(Intent.EXTRA_SUBJECT, title)
            shareIntent.putExtra(Intent.EXTRA_STREAM, uri)
            shareIntent.type = type

            val chooser = Intent.createChooser(shareIntent, context.resources.getString(R.string.share))

            context.packageManager.queryIntentActivities(chooser, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()))

            for (resolveInfo in resInfoList) {
                val packageName = resolveInfo.activityInfo.packageName
                context.grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION)
            }
            context.startActivity(chooser)
        }

✔️ Expected Behavior

The file to be downloaded to the Windows Downloads folder.

❌ Actual Behavior

I get an error: Windows couldn't download file. The file name, directory name or volume label syntax is incorrect.

Other Software

No response

Please specify the version of Windows Subsystem for Android

2311.40000.5.0

@massimobio massimobio added bug Default bug tag for tracking triage-needed For issues raised to be triaged and prioritized by internal Microsoft teams labels Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Default bug tag for tracking triage-needed For issues raised to be triaged and prioritized by internal Microsoft teams
Projects
None yet
Development

No branches or pull requests

1 participant