diff options
author | Bertrand Lorentz <bertrand.lorentz@gmail.com> | 2013-04-07 19:43:42 +0200 |
---|---|---|
committer | Bertrand Lorentz <bertrand.lorentz@gmail.com> | 2013-04-07 19:43:42 +0200 |
commit | 5700f55202f8d2f48f3d13fff5f498c89ef4cfda (patch) | |
tree | decf0f2441734c09c67cafab5634e4d99ee2561b | |
parent | d456a5c16956085f2a0edd2668b4ceb1a1f9c78a (diff) |
PlaylistFileUtil: Only import playlist items that are files (bgo#696877)
When importing a playlist to the library, ignore any element whose URI
scheme is not file://. Local directories are still imported.
The importing process only handles the local path, so allowing remote
URLs would lead to bad things happening, like trying to import
everything under /...
Ignored elements are logged, but no feedback is provided in the UI.
-rw-r--r-- | src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs index 82ae09a01..f30549475 100644 --- a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs +++ b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs @@ -170,6 +170,7 @@ namespace Banshee.Playlist public static void ImportPlaylistToLibrary (string path, PrimarySource source, DatabaseImportManager importer) { try { + Log.InformationFormat ("Importing playlist {0} to library", path); SafeUri uri = new SafeUri (path); PlaylistParser parser = new PlaylistParser (); string relative_dir = System.IO.Path.GetDirectoryName (uri.LocalPath); @@ -180,7 +181,11 @@ namespace Banshee.Playlist if (parser.Parse (uri)) { List<string> uris = new List<string> (); foreach (PlaylistElement element in parser.Elements) { - uris.Add (element.Uri.LocalPath); + if (element.Uri.IsFile) { + uris.Add (element.Uri.LocalPath); + } else { + Log.InformationFormat ("Ignoring invalid playlist element: {0}", element.Uri.OriginalString); + } } if (source == null) { |