add more diagnostics logging for fingerprint issue
OneDrive: backward compatible parsing of paths
This commit is contained in:
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -23,6 +23,7 @@ import com.onedrive.sdk.http.OneDriveServiceException; | ||||
|  | ||||
| import java.io.FileNotFoundException; | ||||
| import java.io.InputStream; | ||||
| import java.io.UnsupportedEncodingException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
|  | ||||
| @@ -166,16 +167,52 @@ public class OneDriveStorage extends JavaFileStorageBase | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|     String removeProtocol(String path) | ||||
|     String getPathFromSkydrivePath(String skydrivePath) | ||||
|     { | ||||
|         String path = ""; | ||||
|         if (skydrivePath.equals("")) | ||||
|             return ""; | ||||
|  | ||||
|         String[] parts = skydrivePath.split("/"); | ||||
|  | ||||
|         for (int i = 0; i < parts.length; i++) { | ||||
|             String part = parts[i]; | ||||
|             logDebug("parsing part " + part); | ||||
|             int indexOfSeparator = part.lastIndexOf(NAME_ID_SEP); | ||||
|             if (indexOfSeparator < 0) { | ||||
|                 // seems invalid, but we're very generous here | ||||
|                 path += "/" + part; | ||||
|                 continue; | ||||
|             } | ||||
|             String name = part.substring(0, indexOfSeparator); | ||||
|             try { | ||||
|                 name = decode(name); | ||||
|             } catch (UnsupportedEncodingException e) { | ||||
|                 // ignore | ||||
|             } | ||||
|             path += "/" + name; | ||||
|         } | ||||
|         logDebug("return " +path + ". original was " + skydrivePath); | ||||
|         return path; | ||||
|  | ||||
|     } | ||||
|  | ||||
|     String removeProtocol(String path) throws Exception { | ||||
|         if (path == null) | ||||
|             return null; | ||||
|         if (path.startsWith("skydrive")) | ||||
|             return getPathFromSkydrivePath(path.substring("skydrive://".length())); | ||||
|         return path.substring(getProtocolId().length()+3); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String getDisplayName(String path) { | ||||
|  | ||||
|         if (path == null) | ||||
|             return null; | ||||
|         if (path.startsWith("skydrive")) | ||||
|             return getProtocolId()+"://"+getPathFromSkydrivePath(path.substring("skydrive://".length())); | ||||
|  | ||||
|         return path; | ||||
|     } | ||||
|  | ||||
| @@ -198,18 +235,21 @@ public class OneDriveStorage extends JavaFileStorageBase | ||||
|     public InputStream openFileForRead(String path) throws Exception { | ||||
|         try { | ||||
|             path = removeProtocol(path); | ||||
|             return oneDriveClient.getDrive() | ||||
|             logDebug("openFileForRead. Path="+path); | ||||
|             InputStream result = oneDriveClient.getDrive() | ||||
|                     .getRoot() | ||||
|                     .getItemWithPath(path) | ||||
|                     .getContent() | ||||
|                     .buildRequest() | ||||
|                     .get(); | ||||
|             logDebug("ok"); | ||||
|             return result; | ||||
|  | ||||
|         } | ||||
|         catch (OneDriveServiceException e) | ||||
|         { | ||||
|             throw convertException(e); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private Exception convertException(OneDriveServiceException e) { | ||||
|   | ||||
							
								
								
									
										24
									
								
								src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										24
									
								
								src/java/KP2ASoftkeyboard_AS/.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -33,11 +33,11 @@ | ||||
|   </component> | ||||
|   <component name="FileEditorManager"> | ||||
|     <leaf> | ||||
|       <file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="false"> | ||||
|       <file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="true"> | ||||
|         <entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state vertical-scroll-proportion="-11.111111"> | ||||
|               <caret line="318" column="8" selection-start-line="318" selection-start-column="8" selection-end-line="318" selection-end-column="8" /> | ||||
|             <state vertical-scroll-proportion="0.4856631"> | ||||
|               <caret line="399" column="13" selection-start-line="399" selection-start-column="13" selection-end-line="399" selection-end-column="13" /> | ||||
|               <folding /> | ||||
|             </state> | ||||
|           </provider> | ||||
| @@ -119,7 +119,7 @@ | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="gradle.properties" pinned="false" current-in-tab="true"> | ||||
|       <file leaf-file-name="gradle.properties" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/gradle.properties"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state vertical-scroll-proportion="0.0"> | ||||
| @@ -1846,14 +1846,6 @@ | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state vertical-scroll-proportion="-11.111111"> | ||||
|           <caret line="318" column="8" selection-start-line="318" selection-start-column="8" selection-end-line="318" selection-end-column="8" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/build.gradle"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state vertical-scroll-proportion="0.0"> | ||||
| @@ -1886,5 +1878,13 @@ | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state vertical-scroll-proportion="0.4856631"> | ||||
|           <caret line="399" column="13" selection-start-line="399" selection-start-column="13" selection-end-line="399" selection-end-column="13" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|   </component> | ||||
| </project> | ||||
| @@ -26,7 +26,7 @@ namespace keepass2android | ||||
| 			AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog)); | ||||
| 			builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title)); | ||||
| 			List<string> changeLog = new List<string>{ | ||||
| 				ctx.GetString(Resource.String.ChangeLog_1_01f), | ||||
| 				ctx.GetString(Resource.String.ChangeLog_1_01g), | ||||
| 				ctx.GetString(Resource.String.ChangeLog_1_01d), | ||||
| 				ctx.GetString(Resource.String.ChangeLog_1_01), | ||||
| 				ctx.GetString(Resource.String.ChangeLog_1_0_0e), | ||||
|   | ||||
| @@ -278,8 +278,9 @@ namespace keepass2android | ||||
| 				_cryptoObject = new FingerprintManager.CryptoObject(_cipher); | ||||
| 				return true; | ||||
| 			} | ||||
| 			catch (KeyPermanentlyInvalidatedException) | ||||
| 			catch (KeyPermanentlyInvalidatedException e) | ||||
| 			{ | ||||
| 				Kp2aLog.Log("FP: KeyPermanentlyInvalidatedException." + e.ToString()); | ||||
| 				return false; | ||||
| 			} | ||||
| 			catch (KeyStoreException e) | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android"  | ||||
| 			android:versionCode="92"  | ||||
| 			android:versionName="1.01-f"  | ||||
| 			android:versionCode="93"  | ||||
| 			android:versionName="1.01-g"  | ||||
| 			package="keepass2android.keepass2android"  | ||||
| 			android:installLocation="auto"> | ||||
| 	<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> | ||||
|   | ||||
| @@ -680,8 +680,8 @@ | ||||
|   <string name="ActivateAutoFillService_btnAutoFill">Use AutoFill service</string> | ||||
|   <string name="ActivateAutoFillService_toast">Please enable the Keepass2Android service.</string> | ||||
|   <string name="ShowKeyboardDuringFingerprintAuth">Show soft keyboard for password input when fingerprint scan is active.</string> | ||||
|   <string name="ChangeLog_1_01f"> | ||||
|     Version 1.01-f\n | ||||
|   <string name="ChangeLog_1_01g"> | ||||
|     Version 1.01-g\n | ||||
|     * Fix for crash when trying to work offline\n | ||||
|     * Fix for incorrect encoding of FTP(S) credentials\n | ||||
|     * Fix for crashes when using OneDrive and on older Android versions\n | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll