[banshee/stable-2.6] PlaylistFileUtil: Only import playlist items that are files (bgo#696877)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-2.6] PlaylistFileUtil: Only import playlist items that are files (bgo#696877)
- Date: Sun, 7 Apr 2013 18:04:33 +0000 (UTC)
commit b5c3edf3a5b7d18819aa3d4a5b18f6c132e971da
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sun Apr 7 19:43:42 2013 +0200
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.
.../Banshee.Playlist/PlaylistFileUtil.cs | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
index 146201d..470526d 100644
--- a/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
+++ b/src/Core/Banshee.Services/Banshee.Playlist/PlaylistFileUtil.cs
@@ -186,6 +186,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);
@@ -196,7 +197,12 @@ namespace Banshee.Playlist
if (parser.Parse (uri)) {
List<string> uris = new List<string> ();
foreach (Dictionary<string, object> element in parser.Elements) {
- uris.Add (((Uri)element["uri"]).LocalPath);
+ Uri elt = (Uri)element["uri"];
+ if (elt.IsFile) {
+ uris.Add (elt.LocalPath);
+ } else {
+ Log.InformationFormat ("Ignoring invalid playlist element: {0}",
elt.OriginalString);
+ }
}
if (source == null) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]