From 760a17bfc38cfc5e1d3325ae41ed8af335f2dcac Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 13 Aug 2015 16:18:38 +0200 Subject: Fix parsing when the config starts with a byte order marker --- main/src/main/java/de/blinkt/openvpn/core/ConfigParser.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'main') 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_")) { -- cgit v1.2.3