File tree Expand file tree Collapse file tree
owncloudApp/src/main/java/com/owncloud/android/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838public 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 }
You can’t perform that action at this time.
0 commit comments