diff --git a/example/src/main/java/io/tus/android/example/MainActivity.java b/example/src/main/java/io/tus/android/example/MainActivity.java index 84f9e88..7295587 100644 --- a/example/src/main/java/io/tus/android/example/MainActivity.java +++ b/example/src/main/java/io/tus/android/example/MainActivity.java @@ -47,6 +47,7 @@ protected void onCreate(Bundle savedInstanceState) { client = new TusClient(); client.setUploadCreationURL(new URL("https://tusd.tusdemo.net/files/")); client.enableResuming(new TusPreferencesURLStore(pref)); + client.enableRemoveFingerprintOnSuccess(); } catch (Exception e) { showError(e); } diff --git a/tus-android-client/src/main/java/io/tus/android/client/TusAndroidUpload.java b/tus-android-client/src/main/java/io/tus/android/client/TusAndroidUpload.java index 4a626dc..ce2fba4 100644 --- a/tus-android-client/src/main/java/io/tus/android/client/TusAndroidUpload.java +++ b/tus-android-client/src/main/java/io/tus/android/client/TusAndroidUpload.java @@ -27,6 +27,11 @@ public TusAndroidUpload(Uri uri, Context context) throws FileNotFoundException { cursor.moveToFirst(); String name = cursor.getString(nameIndex); + String mimType = resolver.getType(uri); + if(mimType == null){ + mimType = "application/octet-stream"; + } + // On some files, ContentResolver#query will report the wrong filesize // even though the InputStream reads the correct length. This discrepancy // causes mismatching upload offsets when the upload should be finished. @@ -52,6 +57,7 @@ public TusAndroidUpload(Uri uri, Context context) throws FileNotFoundException { Map metadata = new HashMap<>(); metadata.put("filename", name); + metadata.put("filetype", mimType); setMetadata(metadata); cursor.close();