Skip to content

Commit

Permalink
fixed file extensions (#31)
Browse files Browse the repository at this point in the history
* fixed file extensions

* fix

* fix lint errors

---------

Co-authored-by: Subhradeep <beradeep35@gmail.com>
  • Loading branch information
tromshusky and beradeep authored Sep 24, 2024
1 parent 173eedf commit 6559a6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/bera/whitehole/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ suspend fun sendFileViaUri(
val fileExtension = getExtFromMimeType(mimeType!!)
val inputStream = contentResolver.openInputStream(uri)
inputStream?.use { ipStream ->
val tempFile = File.createTempFile(Random.nextLong().toString(), fileExtension)
val tempFile = File.createTempFile(Random.nextLong().toString(), ".$fileExtension")
val outputStream = FileOutputStream(tempFile)
ipStream.copyTo(outputStream)
sendFileApi(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class PeriodicPhotoBackupWorker(
}
} while (outputBytes.size > compressionThresholdInBytes && quality > 25)
tempFile = File.createTempFile(
"${Random.nextLong()}",
ext
Random.nextLong().toString(),
".$ext"
)
tempFile.writeBytes(outputBytes)
sendFileApi(botApi, channelId, uri, tempFile, ext!!)
Expand Down Expand Up @@ -113,4 +113,4 @@ class PeriodicPhotoBackupWorker(
const val KEY_COMPRESSION_THRESHOLD = "KEY_COMPRESSION_THRESHOLD"
const val KEY_RESULT_ERROR = "KEY_RESULT_ERROR"
}
}
}

0 comments on commit 6559a6d

Please sign in to comment.