[Android] Videos: Fix ban folder

Duncan McNamara git at videolan.org
Thu Feb 8 07:37:59 UTC 2024


vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Wed Jan 31 15:11:36 2024 +0100| [a62409768e9c05d987bbc28139065fbd851fc7fc] | committer: Nicolas Pomepuy

Videos: Fix ban folder

Folder mrl are encoded, which makes the new File(...) in the
medialibrary java wrapper fail, before being sent to the medialibrary.

> https://code.videolan.org/videolan/vlc-android/commit/a62409768e9c05d987bbc28139065fbd851fc7fc
---

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt  | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index 971c4ac678..9dd169a974 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -28,6 +28,7 @@ import android.view.*
 import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.view.ActionMode
 import androidx.coordinatorlayout.widget.CoordinatorLayout
+import androidx.core.net.toUri
 import androidx.fragment.app.FragmentActivity
 import androidx.lifecycle.Observer
 import androidx.lifecycle.lifecycleScope
@@ -560,7 +561,9 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
     }
 
     private fun banFolder(folder: Folder) {
-        MedialibraryUtils.banDir(folder.mMrl.removePrefix("file://"))
+        folder.mMrl.toUri().path?.let { path ->
+            MedialibraryUtils.banDir(path.removePrefix("file://"))
+        } ?: Log.e(TAG, "banFolder: path is null")
     }
 
     private fun renameGroup(media: VideoGroup) {



More information about the Android mailing list