moved the trimming of inline meta-data to where File is created
This commit is contained in:
@@ -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,
|
||||||
)
|
)
|
||||||
@@ -202,7 +202,7 @@ object MediaSaverToDisk {
|
|||||||
) {
|
) {
|
||||||
val contentValues =
|
val contentValues =
|
||||||
ContentValues().apply {
|
ContentValues().apply {
|
||||||
put(MediaStore.MediaColumns.DISPLAY_NAME, trimInlineMetaData(displayName))
|
put(MediaStore.MediaColumns.DISPLAY_NAME, displayName)
|
||||||
put(MediaStore.MediaColumns.MIME_TYPE, contentType)
|
put(MediaStore.MediaColumns.MIME_TYPE, contentType)
|
||||||
put(
|
put(
|
||||||
MediaStore.MediaColumns.RELATIVE_PATH,
|
MediaStore.MediaColumns.RELATIVE_PATH,
|
||||||
@@ -246,7 +246,7 @@ object MediaSaverToDisk {
|
|||||||
subdirectory.mkdirs()
|
subdirectory.mkdirs()
|
||||||
}
|
}
|
||||||
|
|
||||||
val outputFile = File(subdirectory, trimInlineMetaData(fileName))
|
val outputFile = File(subdirectory, fileName)
|
||||||
|
|
||||||
outputFile.outputStream().use { contentSource.readAll(it.sink()) }
|
outputFile.outputStream().use { contentSource.readAll(it.sink()) }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user