add canonical URL as first item in ordered mirror list
This makes it display nicely in RepoDetails, and is natural, since it is the canonical URL. This also maintains the order as received from the mirror entries in the index file.
This commit is contained in:
parent
421270ad5f
commit
aebf7efc10
@ -65,9 +65,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
@ -294,11 +294,10 @@ public class IndexV1Updater extends IndexUpdater {
|
||||
repo.icon = getStringRepoValue(repoMap, "icon");
|
||||
repo.description = getStringRepoValue(repoMap, "description");
|
||||
|
||||
// ensure the canonical URL is included in the "mirrors" list
|
||||
List<String> mirrorsList = getStringListRepoValue(repoMap, "mirrors");
|
||||
HashSet<String> mirrors = new HashSet<>(mirrorsList.size() + 1);
|
||||
mirrors.addAll(mirrorsList);
|
||||
// ensure the canonical URL is included in the "mirrors" list as the first entry
|
||||
TreeSet<String> mirrors = new TreeSet<>();
|
||||
mirrors.add(repo.address);
|
||||
mirrors.addAll(getStringListRepoValue(repoMap, "mirrors"));
|
||||
repo.mirrors = mirrors.toArray(new String[mirrors.size()]);
|
||||
|
||||
// below are optional, can be default value
|
||||
|
Loading…
x
Reference in New Issue
Block a user