[rygel] media-export: Uri-escape meta-data fields



commit 9ccac735c02b5e080ca6d1ed2ef1cafe6b046808
Author: Jens Georg <mail jensge org>
Date:   Fri Mar 12 22:52:47 2010 +0100

    media-export: Uri-escape meta-data fields
    
    Uri-escape the fields in case they contain a ",". This was already
    documented but not implemented.

 .../rygel-media-export-query-container.vala        |    8 +++++---
 .../rygel-media-export-root-container.vala         |    4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-query-container.vala b/src/plugins/media-export/rygel-media-export-query-container.vala
index cc2159e..42199d9 100644
--- a/src/plugins/media-export/rygel-media-export-query-container.vala
+++ b/src/plugins/media-export/rygel-media-export-query-container.vala
@@ -55,9 +55,10 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
         int i = args.length - 1 - args.length % 2;
         while (i >= 1 - args.length % 2) {
             var exp = new RelationalExpression ();
-            exp.operand1 = args[i - 1].replace (PREFIX, "");
+            var op1 = args[i - 1].replace (PREFIX, "");
+            exp.operand1 = Uri.unescape_string (op1);
             exp.op = SearchCriteriaOp.EQ;
-            exp.operand2 = args[i];
+            exp.operand2 = Uri.unescape_string (args[i]);
             if (this.expression != null) {
                 var exp2 = new LogicalExpression ();
                 exp2.operand1 = this.expression;
@@ -138,7 +139,8 @@ internal class Rygel.MediaExportQueryContainer : Rygel.MediaDBContainer {
                 continue;
             }
 
-            var new_id = this.plaintext_id + "," + meta_data;
+            var new_id = this.plaintext_id + ",";
+            new_id += Uri.escape_string (meta_data, "", true);
             new_id = register_virtual_container (new_id);
             var container = new MediaExportQueryContainer (this.media_db,
                                                            new_id,
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index 6047d09..be96e7f 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -185,8 +185,8 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
             }
 
             if (cont != null) {
-                string new_id = "virtual-container:" + exp_.operand1 +
-                                "," + exp_.operand2 +
+                string new_id = "virtual-container:" + exp_.operand1 + "," +
+                                Uri.escape_string (exp_.operand2, "", true) +
                                 cont.plaintext_id.replace ("virtual-container:", ",");
                 debug ("Translated search request to %s", new_id);
                 new_id = MediaExportQueryContainer.register_virtual_container



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