mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:39:18 +01:00
Allow category names with different casing (fixes #3465)
This commit is contained in:
parent
a928d9fa0b
commit
4bc2288806
@ -325,7 +325,7 @@ class BackupManager(val context: Context, version: Int = CURRENT_VERSION) {
|
|||||||
for (dbCategory in dbCategories) {
|
for (dbCategory in dbCategories) {
|
||||||
// If the category is already in the db, assign the id to the file's category
|
// If the category is already in the db, assign the id to the file's category
|
||||||
// and do nothing
|
// and do nothing
|
||||||
if (category.nameLower == dbCategory.nameLower) {
|
if (category.name == dbCategory.name) {
|
||||||
category.id = dbCategory.id
|
category.id = dbCategory.id
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
@ -353,7 +353,7 @@ class BackupManager(val context: Context, version: Int = CURRENT_VERSION) {
|
|||||||
val mangaCategoriesToUpdate = mutableListOf<MangaCategory>()
|
val mangaCategoriesToUpdate = mutableListOf<MangaCategory>()
|
||||||
for (backupCategoryStr in categories) {
|
for (backupCategoryStr in categories) {
|
||||||
for (dbCategory in dbCategories) {
|
for (dbCategory in dbCategories) {
|
||||||
if (backupCategoryStr.toLowerCase() == dbCategory.nameLower) {
|
if (backupCategoryStr == dbCategory.name) {
|
||||||
mangaCategoriesToUpdate.add(MangaCategory.create(manga, dbCategory))
|
mangaCategoriesToUpdate.add(MangaCategory.create(manga, dbCategory))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,6 @@ interface Category : Serializable {
|
|||||||
|
|
||||||
var flags: Int
|
var flags: Int
|
||||||
|
|
||||||
val nameLower: String
|
|
||||||
get() = name.toLowerCase()
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
fun create(name: String): Category = CategoryImpl().apply {
|
fun create(name: String): Category = CategoryImpl().apply {
|
||||||
|
@ -101,6 +101,6 @@ class CategoryPresenter(
|
|||||||
* Returns true if a category with the given name already exists.
|
* Returns true if a category with the given name already exists.
|
||||||
*/
|
*/
|
||||||
private fun categoryExists(name: String): Boolean {
|
private fun categoryExists(name: String): Boolean {
|
||||||
return categories.any { it.name.equals(name, true) }
|
return categories.any { it.name == name }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user