[banshee] 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] PlaylistFileUtil: Only import playlist items that are files (bgo#696877)
- Date: Sun, 7 Apr 2013 17:55:39 +0000 (UTC)
commit 5700f55202f8d2f48f3d13fff5f498c89ef4cfda
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 | 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 82ae09a..f305494 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]