[grilo/0.2.x] core: Remove trailing '/' from GrlMedia IDs
- From: Juan A. Suárez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo/0.2.x] core: Remove trailing '/' from GrlMedia IDs
- Date: Sat, 19 Dec 2015 11:26:55 +0000 (UTC)
commit af95606ad625664b0ac7f6e122b822d8c300f53e
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 1 16:17:02 2015 +0100
core: Remove trailing '/' from GrlMedia IDs
grl-launch-0.3 -S browse -k title grlbox://grl-tracker-source/videos/
should have the same output as:
grl-launch-0.3 -S browse -k title grlbox://grl-tracker-source/videos
The first would get its ID parsed to "videos/" whereas the second would
be parsed to "videos". Chomp the trailing '/'.
https://bugzilla.gnome.org/show_bug.cgi?id=758654
src/data/grl-media.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index 8111a11..d2bc2a7 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -35,6 +35,7 @@
#include "grl-media.h"
#include <grilo.h>
#include <stdlib.h>
+#include <string.h>
#define GRL_LOG_DOMAIN_DEFAULT media_log_domain
GRL_LOG_DOMAIN(media_log_domain);
@@ -551,6 +552,9 @@ grl_media_unserialize (const gchar *serial)
/* Add id */
escaped_value = g_match_info_fetch (match_info, 3);
if (escaped_value && escaped_value[0] == '/') {
+ guint len = strlen (escaped_value);
+ if (len > 2 && escaped_value[len - 1] == '/')
+ escaped_value[len - 1] = '\0';
value = g_uri_unescape_string (escaped_value + 1, NULL);
grl_media_set_id (media, value);
g_free (value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]