Skip to content

Commit

Permalink
Fix profile pic upload issue
Browse files Browse the repository at this point in the history
Changed the file naming.
  • Loading branch information
adhiamboperes committed Sep 3, 2024
1 parent 34e8da5 commit c249066
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.oppia.android.util.profile.ProfileNameValidator
import org.oppia.android.util.system.OppiaClock
import java.io.File
import java.io.FileOutputStream
import java.util.UUID
import javax.inject.Inject
import javax.inject.Singleton

Expand Down Expand Up @@ -1221,7 +1222,7 @@ class ProfileManagementController @Inject constructor(
// TODO(#3616): Migrate to the proper SDK 29+ APIs.
@Suppress("DEPRECATION") // The code is correct for targeted versions of Android.
val bitmap = MediaStore.Images.Media.getBitmap(context.contentResolver, avatarImagePath)
val fileName = avatarImagePath.path?.substringAfterLast("/") ?: ""
val fileName = UUID.randomUUID().toString()
val imageFile = File(profileDir, fileName)
try {
FileOutputStream(imageFile).use { fos ->
Expand Down

0 comments on commit c249066

Please sign in to comment.