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
=== modified file 'service/dispatcher.c'
--- service/dispatcher.c 2014-09-02 20:39:03 +0000
+++ service/dispatcher.c 2014-09-22 14:46:32 +0000
@@ -31,8 +31,6 @@
31static GRegex * applicationre = NULL;31static GRegex * applicationre = NULL;
32static GRegex * appidre = NULL;32static GRegex * appidre = NULL;
33static GRegex * genericre = NULL;33static GRegex * genericre = NULL;
34static GRegex * musicfilere = NULL; /* FIXME */
35static GRegex * videofilere = NULL; /* FIXME */
36static sqlite3 * urldb = NULL;34static sqlite3 * urldb = NULL;
3735
38/* Errors */36/* Errors */
@@ -364,34 +362,6 @@
364 }362 }
365 g_match_info_free(appmatch);363 g_match_info_free(appmatch);
366364
367 /* start FIXME: These are needed work arounds until everything migrates away
368 from them. Ewww */
369 GMatchInfo * musicmatch = NULL;
370 if (g_regex_match(musicfilere, url, 0, &musicmatch)) {
371 gboolean retval = FALSE;
372
373 *out_appid = ubuntu_app_launch_triplet_to_app_id("com.ubuntu.music", "music", NULL);
374 if (*out_appid != NULL) {
375 *out_url = url;
376 retval = TRUE;
377 }
378
379 g_match_info_free(musicmatch);
380 return retval;
381 }
382 g_match_info_free(musicmatch);
383
384 GMatchInfo * videomatch = NULL;
385 if (g_regex_match(videofilere, url, 0, &videomatch)) {
386 *out_appid = g_strdup("mediaplayer-app");
387 *out_url = url;
388
389 g_match_info_free(videomatch);
390 return TRUE;
391 }
392 g_match_info_free(videomatch);
393 /* end FIXME: Making the ugly stop */
394
395 /* Check the URL db */365 /* Check the URL db */
396 GMatchInfo * genericmatch = NULL;366 GMatchInfo * genericmatch = NULL;
397 if (g_regex_match(genericre, url, 0, &genericmatch)) {367 if (g_regex_match(genericre, url, 0, &genericmatch)) {
@@ -468,8 +438,6 @@
468 return;438 return;
469}439}
470440
471#define USERNAME_REGEX "[a-zA-Z0-9_\\-]*"
472
473/* Initialize all the globals */441/* Initialize all the globals */
474gboolean442gboolean
475dispatcher_init (GMainLoop * mainloop)443dispatcher_init (GMainLoop * mainloop)
@@ -482,10 +450,6 @@
482 appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);450 appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
483 genericre = g_regex_new("^(.*)://([a-z0-9\\.-]*)?/?(.*)?$", 0, 0, NULL);451 genericre = g_regex_new("^(.*)://([a-z0-9\\.-]*)?/?(.*)?$", 0, 0, NULL);
484452
485 /* FIXME: Legacy */
486 musicfilere = g_regex_new("^file:///home/" USERNAME_REGEX "/Music/", 0, 0, NULL);
487 videofilere = g_regex_new("^file:///home/" USERNAME_REGEX "/Videos/", 0, 0, NULL);
488
489 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);453 g_bus_get(G_BUS_TYPE_SESSION, cancellable, bus_got, mainloop);
490454
491 skel = service_iface_com_canonical_urldispatcher_skeleton_new();455 skel = service_iface_com_canonical_urldispatcher_skeleton_new();
@@ -506,8 +470,6 @@
506 g_regex_unref(applicationre);470 g_regex_unref(applicationre);
507 g_regex_unref(appidre);471 g_regex_unref(appidre);
508 g_regex_unref(genericre);472 g_regex_unref(genericre);
509 g_regex_unref(musicfilere); /* FIXME */
510 g_regex_unref(videofilere); /* FIXME */
511 sqlite3_close(urldb);473 sqlite3_close(urldb);
512474
513 return TRUE;475 return TRUE;
514476
=== modified file 'tests/dispatcher-test.cc'
--- tests/dispatcher-test.cc 2014-08-25 20:15:10 +0000
+++ tests/dispatcher-test.cc 2014-09-22 14:46:32 +0000
@@ -152,25 +152,3 @@
152152
153 return;153 return;
154}154}
155
156/* FIXME: These should go away */
157TEST_F(DispatcherTest, FixmeTest)
158{
159 gchar * out_appid = NULL;
160 const gchar * out_url = NULL;
161
162 /* File Video */
163 dispatcher_url_to_appid("file:///home/bar/Videos/foo.mp4", &out_appid, &out_url);
164 dispatcher_send_to_app(out_appid, out_url);
165 ASSERT_STREQ("mediaplayer-app", ubuntu_app_launch_mock_get_last_app_id());
166 ubuntu_app_launch_mock_clear_last_app_id();
167
168 /* File Video */
169 dispatcher_url_to_appid("file:///home/bar/Music/The_Bars_Live.mp3", &out_appid, &out_url);
170 dispatcher_send_to_app(out_appid, out_url);
171 ASSERT_STREQ("com.ubuntu.music_music_1.5.4", ubuntu_app_launch_mock_get_last_app_id());
172 ubuntu_app_launch_mock_clear_last_app_id();
173
174 return;
175}
176

Subscribers

People subscribed via source and target branches