[rygel/rygel-0-12] core: Shorten title first, then mangle chars



commit 0f3ab0b0354dd6d24a9a12b36090ae94475f7d52
Author: Jens Georg <mail jensge org>
Date:   Thu Oct 13 10:56:06 2011 +0200

    core: Shorten title first, then mangle chars

 src/rygel/rygel-item-creator.vala |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/rygel/rygel-item-creator.vala b/src/rygel/rygel-item-creator.vala
index 5e98ee6..de25154 100644
--- a/src/rygel/rygel-item-creator.vala
+++ b/src/rygel/rygel-item-creator.vala
@@ -373,13 +373,14 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
     }
 
     private string mangle_title (string title) throws Error {
-        var mangled = this.title_regex.replace_literal (title,
-                                                 -1,
-                                                 0,
-                                                 "_",
-                                                 RegexMatchFlags.NOTEMPTY);
-
-        return mangled.substring (0, int.min (mangled.length, 240));
+        var mangled = title.substring (0, int.min (title.length, 240));
+        mangled = this.title_regex.replace_literal (mangled,
+                                                    -1,
+                                                    0,
+                                                    "_",
+                                                    RegexMatchFlags.NOTEMPTY);
+
+        return mangled;
     }
 
     private async string create_uri (WritableContainer container, string title)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]