This commit is contained in:
Vitor Pamplona
2025-03-17 13:55:50 -04:00
@@ -131,14 +131,14 @@ object MediaSaverToDisk {
} }
saveContentQ( saveContentQ(
displayName = File(url).nameWithoutExtension, displayName = File(trimInlineMetaData(url)).nameWithoutExtension,
contentType = realType, contentType = realType,
contentSource = response.body.source(), contentSource = response.body.source(),
contentResolver = context.contentResolver, contentResolver = context.contentResolver,
) )
} else { } else {
saveContentDefault( saveContentDefault(
fileName = File(url).name, fileName = File(trimInlineMetaData(url)).name,
contentSource = response.body.source(), contentSource = response.body.source(),
context = context, context = context,
) )
@@ -255,5 +255,7 @@ object MediaSaverToDisk {
MediaScannerConnection.scanFile(context, arrayOf(outputFile.toString()), null, null) MediaScannerConnection.scanFile(context, arrayOf(outputFile.toString()), null, null)
} }
private fun trimInlineMetaData(url: String): String = url.substringBefore("#")
private const val PICTURES_SUBDIRECTORY = "Amethyst" private const val PICTURES_SUBDIRECTORY = "Amethyst"
} }