diff --git a/app/src/full/java/org/fdroid/fdroid/localrepo/LocalRepoManager.java b/app/src/full/java/org/fdroid/fdroid/localrepo/LocalRepoManager.java index 7ea5905cc..6256b6209 100644 --- a/app/src/full/java/org/fdroid/fdroid/localrepo/LocalRepoManager.java +++ b/app/src/full/java/org/fdroid/fdroid/localrepo/LocalRepoManager.java @@ -17,6 +17,7 @@ import android.util.Log; import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.Hasher; import org.fdroid.fdroid.Preferences; +import org.fdroid.fdroid.RepoUpdater; import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.data.Apk; import org.fdroid.fdroid.data.App; @@ -103,7 +104,7 @@ public final class LocalRepoManager { repoDir = new SanitizedFile(fdroidDir, "repo"); repoDirCaps = new SanitizedFile(fdroidDirCaps, "REPO"); iconsDir = new SanitizedFile(repoDir, "icons"); - xmlIndexJar = new SanitizedFile(repoDir, "index.jar"); + xmlIndexJar = new SanitizedFile(repoDir, RepoUpdater.SIGNED_FILE_NAME); xmlIndexJarUnsigned = new SanitizedFile(repoDir, "index.unsigned.jar"); if (!fdroidDir.exists() && !fdroidDir.mkdir()) { @@ -481,7 +482,7 @@ public final class LocalRepoManager { public void writeIndexJar() throws IOException, XmlPullParserException, LocalRepoKeyStore.InitException { BufferedOutputStream bo = new BufferedOutputStream(new FileOutputStream(xmlIndexJarUnsigned)); JarOutputStream jo = new JarOutputStream(bo); - JarEntry je = new JarEntry("index.xml"); + JarEntry je = new JarEntry(RepoUpdater.DATA_FILE_NAME); jo.putNextEntry(je); new IndexXmlBuilder().build(context, apps, jo); jo.close(); diff --git a/app/src/main/java/org/fdroid/fdroid/RepoUpdater.java b/app/src/main/java/org/fdroid/fdroid/RepoUpdater.java index 92d78bbc1..6432cd261 100644 --- a/app/src/main/java/org/fdroid/fdroid/RepoUpdater.java +++ b/app/src/main/java/org/fdroid/fdroid/RepoUpdater.java @@ -83,6 +83,9 @@ import java.util.jar.JarFile; public class RepoUpdater { private static final String TAG = "RepoUpdater"; + public static final String SIGNED_FILE_NAME = "index.jar"; + public static final String DATA_FILE_NAME = "index.xml"; + final String indexUrl; @NonNull @@ -205,7 +208,7 @@ public class RepoUpdater { FDroidApp.disableBouncyCastleOnLollipop(); JarFile jarFile = new JarFile(downloadedFile, true); - JarEntry indexEntry = (JarEntry) jarFile.getEntry("index.xml"); + JarEntry indexEntry = (JarEntry) jarFile.getEntry(RepoUpdater.DATA_FILE_NAME); indexInputStream = new ProgressBufferedInputStream(jarFile.getInputStream(indexEntry), processIndexListener, repo.address, (int) indexEntry.getSize()); diff --git a/app/src/main/java/org/fdroid/fdroid/views/ManageReposActivity.java b/app/src/main/java/org/fdroid/fdroid/views/ManageReposActivity.java index dbb5e7b47..85b30525a 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/ManageReposActivity.java +++ b/app/src/main/java/org/fdroid/fdroid/views/ManageReposActivity.java @@ -55,6 +55,7 @@ import android.widget.TextView; import android.widget.Toast; import org.fdroid.fdroid.FDroidApp; import org.fdroid.fdroid.R; +import org.fdroid.fdroid.RepoUpdater; import org.fdroid.fdroid.UpdateService; import org.fdroid.fdroid.Utils; import org.fdroid.fdroid.compat.CursorAdapterCompat; @@ -567,7 +568,7 @@ public class ManageReposActivity extends AppCompatActivity return addressWithoutIndex; } - final Uri uri = builder.appendPath("index.jar").build(); + final Uri uri = builder.appendPath(RepoUpdater.SIGNED_FILE_NAME).build(); try { if (checkForRepository(uri)) {