Add check for osf extension in folder name

This commit is contained in:
Vitaliy 2020-04-01 19:24:08 +03:00
parent 6ec5d526a8
commit 63e4716708

View file

@ -2169,7 +2169,8 @@ public class SettingsHelper {
try {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
if (entry.getName().equals("items.json")) {
String fileName = checkEntryName(entry.getName());
if (fileName.equals("items.json")) {
String itemsJson = null;
try {
itemsJson = Algorithms.readFromInputStream(ois).toString();
@ -2215,7 +2216,7 @@ public class SettingsHelper {
try {
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String fileName = entry.getName();
String fileName = checkEntryName(entry.getName());
SettingsItem item = null;
for (SettingsItem settingsItem : items) {
if (settingsItem != null && settingsItem.applyFileName(fileName)) {
@ -2247,6 +2248,15 @@ public class SettingsHelper {
}
return items;
}
private String checkEntryName(String entryName) {
String fileExt = OSMAND_SETTINGS_FILE_EXT + "/";
int index = entryName.indexOf(fileExt);
if (index != -1) {
entryName = entryName.substring(index + fileExt.length());
}
return entryName;
}
}
@SuppressLint("StaticFieldLeak")