[Android] Encode every mrl sent to medialibrary

Geoffrey Métais git at videolan.org
Mon Dec 11 14:55:21 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec  8 17:47:25 2017 +0100| [f853e2b866474bb1ce601ad6a34393fedcc15c9d] | committer: Geoffrey Métais

Encode every mrl sent to medialibrary

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

 medialibrary/src/org/videolan/medialibrary/Medialibrary.java | 5 ++---
 medialibrary/src/org/videolan/medialibrary/Tools.java        | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
index 9c8e1e244..04e7a683d 100644
--- a/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
+++ b/medialibrary/src/org/videolan/medialibrary/Medialibrary.java
@@ -15,7 +15,6 @@ import android.support.v4.content.LocalBroadcastManager;
 import android.text.TextUtils;
 import android.util.Log;
 
-import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.util.VLCUtil;
 import org.videolan.medialibrary.interfaces.DevicesDiscoveryCb;
 import org.videolan.medialibrary.interfaces.EntryPointsEventsCb;
@@ -99,12 +98,12 @@ public class Medialibrary {
 
     public void banFolder(@NonNull String path) {
         if (mIsInitiated && new File(path).exists())
-            nativeBanFolder(Tools.encodeVLCMrl(Uri.encode(path, "/")));
+            nativeBanFolder(path);
     }
 
     public void unbanFolder(@NonNull String path) {
         if (mIsInitiated && new File(path).exists())
-            nativeUnbanFolder(Tools.encodeVLCMrl(Uri.encode(path, "/")));
+            nativeUnbanFolder(path);
     }
 
     public String[] getDevices() {
diff --git a/medialibrary/src/org/videolan/medialibrary/Tools.java b/medialibrary/src/org/videolan/medialibrary/Tools.java
index 6077f8541..efd5ddbc6 100644
--- a/medialibrary/src/org/videolan/medialibrary/Tools.java
+++ b/medialibrary/src/org/videolan/medialibrary/Tools.java
@@ -125,9 +125,9 @@ public class Tools {
         return sb.toString();
     }
 
-    public static String encodeVLCMrl(String mrl) {
+    static String encodeVLCMrl(String mrl) {
         if (mrl.startsWith("/"))
             mrl = "file://"+mrl;
-        return VLCUtil.encodeVLCString(mrl);
+        return VLCUtil.encodeVLCString(Uri.encode(mrl, ":/"));
     }
 }



More information about the Android mailing list