Skip to content

Commit 1fb428e

Browse files
david-allisonlukstbit
authored andcommitted
fix(tags): nesting broken if casing differed
Tags are case insensitive, and we forgot a mapping caused by two parent tags with different 'v' casing ``` AK_Step1_v12 AK_Step1_V12 ``` => ``` #AK_Step1_v12::#Pixorize::03_Pharmacology::22_Cardiovascular_(New)::01_Ivabradine #AK_Step1_V12::#Pixorize::03_Pharmacology::22_Cardiovascular_(New)::02_Nitroprusside ``` Which caused `02_Nitroprusside` to be a top level deck Fixes 18481
1 parent 15cadc2 commit 1fb428e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/dialogs/tags/TagsArrayAdapter.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ class TagsArrayAdapter(
354354
*
355355
* @param expandTarget The target tag to expand. Do nothing if it is empty or not found.
356356
*/
357+
@NeedsTest("#18481 - case insensitivity")
357358
private fun buildTagTree(expandTarget: String) {
358359
// init mapping for newly added tags
359360
filteredList.forEach {
@@ -380,7 +381,7 @@ class TagsArrayAdapter(
380381
for (tag in filteredList) {
381382
// root will never be popped
382383
while (stack.size > 1) {
383-
if (!tag.startsWith(stack.peek().tag + "::")) {
384+
if (!tag.startsWith(stack.peek().tag + "::", ignoreCase = true)) {
384385
stackPopAndPushUp()
385386
} else {
386387
break

0 commit comments

Comments
 (0)