diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/MediaSaverToDisk.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/MediaSaverToDisk.kt index abed7ed57..5e7583c6f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/MediaSaverToDisk.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/actions/MediaSaverToDisk.kt @@ -131,14 +131,14 @@ object MediaSaverToDisk { } saveContentQ( - displayName = File(url).nameWithoutExtension, + displayName = File(trimInlineMetaData(url)).nameWithoutExtension, contentType = realType, contentSource = response.body.source(), contentResolver = context.contentResolver, ) } else { saveContentDefault( - fileName = File(url).name, + fileName = File(trimInlineMetaData(url)).name, contentSource = response.body.source(), context = context, ) @@ -255,5 +255,7 @@ object MediaSaverToDisk { MediaScannerConnection.scanFile(context, arrayOf(outputFile.toString()), null, null) } + private fun trimInlineMetaData(url: String): String = url.substringBefore("#") + private const val PICTURES_SUBDIRECTORY = "Amethyst" }