content tree rebuilding ifcheck fix

This commit is contained in:
xis 2023-10-15 19:24:43 +02:00
parent 0f5eba1ebe
commit 4ab02bfafe
2 changed files with 9 additions and 11 deletions

View file

@ -60,9 +60,13 @@ class NextcloudDB(
}
private fun asItem(f: Filecache): ContentItem {
try {
val format = MediaFormat.fromMimeType(mimetypes[f.mimetype]!!)
val path: String = buildPath(f)
return ContentItem(f.id, f.parent, f.name, path, format, f.size)
} catch (e: Exception) {
throw RuntimeException("Unable to create ContentItem for ${f.path}: ${e.message}")
}
}
private fun asNode(f: Filecache): ContentNode {

View file

@ -2,18 +2,12 @@ package net.schowek.nextclouddlna.nextcloud.content
import net.schowek.nextclouddlna.nextcloud.NextcloudDB
import spock.lang.Specification
import java.time.Clock
import java.time.Instant
import java.time.ZoneId
import java.time.temporal.ChronoUnit
import java.time.temporal.Temporal
import java.time.temporal.TemporalUnit
import java.util.function.Consumer
import static java.time.Instant.*
import static java.time.Instant.now
import static java.time.temporal.ChronoUnit.*
import static java.time.Instant.ofEpochSecond
import static java.time.temporal.ChronoUnit.DAYS
class ContentTreeProviderTest extends Specification {
def nextcloudDB