From d5e947f2dd9ba93a4bb6a801d0ef8ad21d43d8d2 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Fri, 29 Nov 2013 19:15:58 +0100 Subject: Fix empty profile when importing from a content provider --- icsopenvpn.iml | 8 ++++---- src/de/blinkt/openvpn/ConfigConverter.java | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/icsopenvpn.iml b/icsopenvpn.iml index c0ba6aa7..ad327925 100644 --- a/icsopenvpn.iml +++ b/icsopenvpn.iml @@ -23,10 +23,10 @@ - - - - + + + + diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 75620455..d0782a8a 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -188,7 +188,7 @@ public class ConfigConverter extends ListActivity { if(mResult.mName!=null && !ConfigParser.CONVERTED_PROFILE.equals(mResult.mName)) newname=mResult.mName; - while(vpl.getProfileByName(newname)!=null) { + while(newname==null || vpl.getProfileByName(newname)!=null) { i++; if(i==1) newname = getString(R.string.converted_profile); @@ -368,7 +368,10 @@ public class ConfigConverter extends ListActivity { //log(R.string.import_experimental); log(R.string.importing_config,data.toString()); try { - if(data.getScheme().equals("file")) { + if(data.getScheme().equals("file") || + data.getLastPathSegment().endsWith(".ovpn") || + data.getLastPathSegment().endsWith(".conf")) + { mPossibleName = data.getLastPathSegment(); if(mPossibleName!=null){ mPossibleName =mPossibleName.replace(".ovpn", ""); -- cgit v1.2.3