From d8a5ec3f1999cb07e5f5677ba2f87910d96da98b Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 30 Jul 2017 02:18:17 -0500 Subject: [PATCH] ProfileService: Only load from files ending with .conf This condition was previously enforced in the AsyncTask, but was lost in the move from ProfileListActivity to ProfileService. Signed-off-by: Jason A. Donenfeld --- .../main/java/com/wireguard/android/ProfileService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/wireguard/android/ProfileService.java b/app/src/main/java/com/wireguard/android/ProfileService.java index 172f230c..faecde72 100644 --- a/app/src/main/java/com/wireguard/android/ProfileService.java +++ b/app/src/main/java/com/wireguard/android/ProfileService.java @@ -12,6 +12,7 @@ import android.util.Log; import com.wireguard.config.Profile; import java.io.File; +import java.io.FilenameFilter; import java.io.IOException; import java.util.LinkedList; import java.util.List; @@ -33,7 +34,12 @@ public class ProfileService extends Service { @Override public void onCreate() { - new ProfileLoader().execute(getFilesDir().listFiles()); + new ProfileLoader().execute(getFilesDir().listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".conf"); + } + })); } @Override