fix generating content paths

This commit is contained in:
xis 2023-10-10 15:46:02 +02:00
parent 4e8ddbb5bf
commit 2b212b9607
2 changed files with 11 additions and 12 deletions

View file

@ -32,7 +32,8 @@ class MediaDB(
@Transactional(readOnly = true)
fun processThumbnails(thumbConsumer: Consumer<ContentItem>) {
filecacheRepository.findThumbnails("${nextcloudConfig.appDataDir}/preview/%", thumbStorageId, folderMimeType).use { files ->
filecacheRepository.findThumbnails("${nextcloudConfig.appDataDir}/preview/%", thumbStorageId, folderMimeType)
.use { files ->
files.map { f: Filecache -> asItem(f) }.forEach(thumbConsumer)
}
}
@ -95,9 +96,9 @@ class MediaDB(
private fun buildPath(f: Filecache): String {
return if (storageUsersMap.containsKey(f.storage)) {
val userName: String? = storageUsersMap[f.storage]
nextcloudConfig.appDataDir + "/" + userName + "/" + f.path
"${nextcloudConfig.nextcloudDir}/$userName/${f.path}"
} else {
nextcloudConfig.appDataDir + "/" + f.path
"${nextcloudConfig.nextcloudDir}/${f.path}"
}
}

View file

@ -20,11 +20,6 @@ class NextcloudConfigDiscovery(
final val appDataDir: String = findAppDataDir()
final val supportsGroupFolders: Boolean = checkGroupFoldersSupport()
@PostConstruct
fun init() {
logger.info("Found appdata dir: {}", appDataDir)
}
private fun checkGroupFoldersSupport(): Boolean {
return "yes" == appConfigRepository.getValue("groupfolders", "enabled")
}
@ -33,6 +28,9 @@ class NextcloudConfigDiscovery(
return stream(requireNonNull(File(nextcloudDir).listFiles { f ->
f.isDirectory && f.name.matches(APPDATA_NAME_PATTERN.toRegex())
})).findFirst().orElseThrow().name
.also {
logger.info { "Found appdata dir: $it" }
}
}
companion object : KLogging() {