summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-08-13 16:18:38 +0200
committerArne Schwabe <arne@rfc2549.org>2015-08-13 16:18:38 +0200
commit760a17bfc38cfc5e1d3325ae41ed8af335f2dcac (patch)
tree8bd9a73279abac180c191e43e6bc37abb1722662
parent4c1fad5c0c5dba5352956f615298dcd0f93ff13e (diff)
Fix parsing when the config starts with a byte order marker
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
index 0d7d54c0..028c8816 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java
@@ -48,9 +48,15 @@ public class ConfigParser {
if (line == null)
break;
- if (lineno == 1 && (line.startsWith("PK\003\004")
- || (line.startsWith("PK\007\008"))))
- throw new ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
+ if (lineno == 1) {
+ if ((line.startsWith("PK\003\004")
+ || (line.startsWith("PK\007\008")))) {
+ throw new ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
+ }
+ if (line.startsWith("\uFEFF")) {
+ line = line.substring(1);
+ }
+ }
// Check for OpenVPN Access Server Meta information
if (line.startsWith("# OVPN_ACCESS_SERVER_")) {