1

Having an issue with URIs in Android 5+

In our application we upload documents to the users personal 'My Documents' folder on the server. The server contains strickt firewall rules regarding what's sent, one of them being null bytes are not allowed.

The other day all our users were blocked because a mass of Android version 5+ phones were sending null bytes when uploading documents according to logs with user agent strings.

After some digging I discovered that when the user 'shares' a document, then 'shares' it again they come across a null content resolution, some code:

public class UploadMyDocumentsIntentService extends IntentService {
...
protected void onHandleIntent(Intent intent) {
...
The following will resolve as null.
getContentResolver().openInputStream(uri)

URI:
-1/1/file:/storage/emulated/0/DCIM/Camera/IMG_20151005_113848.jpg/ACTUAL/491980602

Does anyone know if there are some core changes on 5+ that would effect layer share uri? Or maybe I'm doing something wrong?

** Edit **

If anyone wants to replicate this pretty easy to do.
1. Open a photo with ES file explorer (Or other app) and share with photos.
2. Share the same photos with you're application from photos
3. Unresolvable URI.

OlzD
  • 41
  • 6

0 Answers0