Skip to content

Commit 7341fb0

Browse files
committed
QA - Condition with logs extensions
1 parent 79455cf commit 7341fb0

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

  • owncloudApp/src/main/java/com/owncloud/android/utils

owncloudApp/src/main/java/com/owncloud/android/utils/UriUtils.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
public class UriUtils {
3939

4040
public static final String URI_CONTENT_SCHEME = "content://";
41+
public static final String LOG_EXTENSION = "log";
4142

4243
public static String getDisplayNameForUri(Uri uri, Context context) {
4344

@@ -63,15 +64,17 @@ public static String getDisplayNameForUri(Uri uri, Context context) {
6364

6465
// Add best possible extension
6566
int index = displayName.lastIndexOf(".");
66-
if (index == -1 || MimeTypeMap.getSingleton().
67-
getMimeTypeFromExtension(displayName.substring(index + 1)) == null) {
68-
String mimeType = context.getContentResolver().getType(uri);
69-
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
70-
if (extension != null) {
71-
displayName += "." + extension;
67+
String fileExtension = displayName.substring(index + 1);
68+
if(!(LOG_EXTENSION.equalsIgnoreCase(fileExtension))) {
69+
if (index == -1 || MimeTypeMap.getSingleton().
70+
getMimeTypeFromExtension(fileExtension) == null) {
71+
String mimeType = context.getContentResolver().getType(uri);
72+
String extension = MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
73+
if (extension != null) {
74+
displayName += "." + extension;
75+
}
7276
}
7377
}
74-
7578
} catch (Exception e) {
7679
Timber.e(e, "No way to get a display name for %s", uri.toString());
7780
}

0 commit comments

Comments
 (0)