Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/freenet/clients/http/WelcomeToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ private void addCategoryToList(BookmarkCategory cat, HTMLNode list, boolean noAc
// extract the key type
String keyType = initialKey.substring(1,3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has to go from 0 to 3 — Java is zero-indexed.

String key = '/' + initialKey + (initialKey.endsWith("/") ? "" : "/");
switch keyType {
switch (keyType) {
case "USK":
case "SSK":
Matcher match = PATTERN_USK_SSK.matcher(key);
if match.matches() {
if (match.matches()) {
key = match.group(1) + "activelink.png";
}
else { // If no edition # exists, assume bare SSK and just append the activelink.
match = PATTERN_BARE_SSK_CHK_KSK.matcher(key);
if match.matches() {
if (match.matches()) {
key = match.group(1) + "activelink.png";
}
else {
Expand All @@ -111,7 +111,7 @@ private void addCategoryToList(BookmarkCategory cat, HTMLNode list, boolean noAc
case "CHK":
case "KSK": // This assumes the activelink is in the root of any one-shot directory upload.
Matcher match = PATTERN_BARE_SSK_CHK_KSK.matcher(key);
if match.matches() {
if (match.matches()) {
key = match.group(1) + "activelink.png";
}
else { // we append '/' to key at the start if it isn't already there, so this should never be reachable unless the regex is broken.
Expand Down