[vlc-devel] [PATCH 6/6] qt: use QUrl::FullyEncoded to convert QUrl to string in NetworkMediaModel

Pierre Lamot pierre at videolabs.io
Mon Jan 20 14:23:27 CET 2020


  QUrl::None doesn't encode space, thus generate illformed URL

  this patch follows up "qt: fix url encoding of medialibrary endpoints"
---
 modules/gui/qt/network/networkmediamodel.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp
index a7e96a2ac7..c2561e1620 100644
--- a/modules/gui/qt/network/networkmediamodel.cpp
+++ b/modules/gui/qt/network/networkmediamodel.cpp
@@ -114,9 +114,9 @@ bool NetworkMediaModel::setData( const QModelIndex& idx, const QVariant& value,
         return  false;
     int res;
     if ( enabled )
-        res = vlc_ml_add_folder( m_ml, qtu( m_items[idx.row()].mainMrl.toString( QUrl::None ) ) );
+        res = vlc_ml_add_folder( m_ml, qtu( m_items[idx.row()].mainMrl.toString( QUrl::FullyEncoded ) ) );
     else
-        res = vlc_ml_remove_folder( m_ml, qtu( m_items[idx.row()].mainMrl.toString( QUrl::None ) ) );
+        res = vlc_ml_remove_folder( m_ml, qtu( m_items[idx.row()].mainMrl.toString( QUrl::FullyEncoded ) ) );
     m_items[idx.row()].indexed = enabled;
     emit dataChanged(idx, idx, { NETWORK_INDEXED });
     return res == VLC_SUCCESS;
@@ -370,7 +370,7 @@ void NetworkMediaModel::refreshMediaList( MediaSourcePtr mediaSource,
 
         if ( item.canBeIndexed == true )
         {
-            if ( vlc_ml_is_indexed( m_ml, qtu( item.mainMrl.toString( QUrl::None ) ),
+            if ( vlc_ml_is_indexed( m_ml, qtu( item.mainMrl.toString( QUrl::FullyEncoded ) ),
                                     &item.indexed ) != VLC_SUCCESS )
                 item.indexed = false;
         }
-- 
2.17.1



More information about the vlc-devel mailing list