Merge lp:~ted/url-dispatcher/lp1340952-drop-file-urls into lp:url-dispatcher/14.10

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 62
Merged at revision: 72
Proposed branch: lp:~ted/url-dispatcher/lp1340952-drop-file-urls
Merge into: lp:url-dispatcher/14.10
Diff against target: 106 lines (+0/-60)
2 files modified
service/dispatcher.c (+0/-38)
tests/dispatcher-test.cc (+0/-22)
To merge this branch: bzr merge lp:~ted/url-dispatcher/lp1340952-drop-file-urls
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+226860@code.launchpad.net

Commit message

Drop file based URLs for Music and Video

Description of the change

Getting rid of these URLs as they're more restrictive than media scanner and AppArmor, who are the folks that should be doing the restrictions.

Don't land this without other branches attached to the bug, as then things will break.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

> Don't land this without other branches attached to the bug, as then things will break.

There aren't any other branches attached to this bug...?

62. By Ted Gould

Updating to trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'service/dispatcher.c'
2--- service/dispatcher.c 2014-09-02 20:39:03 +0000
3+++ service/dispatcher.c 2014-09-22 14:46:32 +0000
4@@ -31,8 +31,6 @@
5 static GRegex * applicationre = NULL;
6 static GRegex * appidre = NULL;
7 static GRegex * genericre = NULL;
8-static GRegex * musicfilere = NULL; /* FIXME */
9-static GRegex * videofilere = NULL; /* FIXME */
10 static sqlite3 * urldb = NULL;
11
12 /* Errors */
13@@ -364,34 +362,6 @@
14 }
15 g_match_info_free(appmatch);
16
17- /* start FIXME: These are needed work arounds until everything migrates away
18- from them. Ewww */
19- GMatchInfo * musicmatch = NULL;
20- if (g_regex_match(musicfilere, url, 0, &musicmatch)) {
21- gboolean retval = FALSE;
22-
23- *out_appid = ubuntu_app_launch_triplet_to_app_id("com.ubuntu.music", "music", NULL);
24- if (*out_appid != NULL) {
25- *out_url = url;
26- retval = TRUE;
27- }
28-
29- g_match_info_free(musicmatch);
30- return retval;
31- }
32- g_match_info_free(musicmatch);
33-
34- GMatchInfo * videomatch = NULL;
35- if (g_regex_match(videofilere, url, 0, &videomatch)) {
36- *out_appid = g_strdup("mediaplayer-app");
37- *out_url = url;
38-
39- g_match_info_free(videomatch);
40- return TRUE;
41- }
42- g_match_info_free(videomatch);
43- /* end FIXME: Making the ugly stop */
44-
45 /* Check the URL db */
46 GMatchInfo * genericmatch = NULL;
47 if (g_regex_match(genericre, url, 0, &genericmatch)) {
48@@ -468,8 +438,6 @@
49 return;
50 }
51
52-#define USERNAME_REGEX "[a-zA-Z0-9_\\-]*"
53-
54 /* Initialize all the globals */
55 gboolean
56 dispatcher_init (GMainLoop * mainloop)
57@@ -482,10 +450,6 @@
58 appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
59 genericre = g_regex_new("^(.*)://([a-z0-9\\.-]*)?/?(.*)?$", 0, 0, NULL);
60
61- /* FIXME: Legacy */
62- musicfilere = g_regex_new("^file:///home/" USERNAME_REGEX "/Music/", 0, 0, NULL);
63- videofilere = g_regex_new("^file:///home/" USERNAME_REGEX "/Videos/", 0, 0, NULL);
64-
65 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);
66
67 skel = service_iface_com_canonical_urldispatcher_skeleton_new();
68@@ -506,8 +470,6 @@
69 g_regex_unref(applicationre);
70 g_regex_unref(appidre);
71 g_regex_unref(genericre);
72- g_regex_unref(musicfilere); /* FIXME */
73- g_regex_unref(videofilere); /* FIXME */
74 sqlite3_close(urldb);
75
76 return TRUE;
77
78=== modified file 'tests/dispatcher-test.cc'
79--- tests/dispatcher-test.cc 2014-08-25 20:15:10 +0000
80+++ tests/dispatcher-test.cc 2014-09-22 14:46:32 +0000
81@@ -152,25 +152,3 @@
82
83 return;
84 }
85-
86-/* FIXME: These should go away */
87-TEST_F(DispatcherTest, FixmeTest)
88-{
89- gchar * out_appid = NULL;
90- const gchar * out_url = NULL;
91-
92- /* File Video */
93- dispatcher_url_to_appid("file:///home/bar/Videos/foo.mp4", &out_appid, &out_url);
94- dispatcher_send_to_app(out_appid, out_url);
95- ASSERT_STREQ("mediaplayer-app", ubuntu_app_launch_mock_get_last_app_id());
96- ubuntu_app_launch_mock_clear_last_app_id();
97-
98- /* File Video */
99- dispatcher_url_to_appid("file:///home/bar/Music/The_Bars_Live.mp3", &out_appid, &out_url);
100- dispatcher_send_to_app(out_appid, out_url);
101- ASSERT_STREQ("com.ubuntu.music_music_1.5.4", ubuntu_app_launch_mock_get_last_app_id());
102- ubuntu_app_launch_mock_clear_last_app_id();
103-
104- return;
105-}
106-

Subscribers

People subscribed via source and target branches