Merge lp:~larryprice/url-dispatcher/appid-with-dots into lp:url-dispatcher/touch-vivid

Proposed by Ted Gould on 2016-11-07
Status: Approved
Approved by: Ted Gould on 2016-11-07
Approved revision: 93
Proposed branch: lp:~larryprice/url-dispatcher/appid-with-dots
Merge into: lp:url-dispatcher/touch-vivid
Diff against target: 79 lines (+17/-6)
3 files modified
CMakeLists.txt (+4/-5)
service/dispatcher.c (+1/-1)
tests/app-id-test.cc (+12/-0)
To merge this branch: bzr merge lp:~larryprice/url-dispatcher/appid-with-dots
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve on 2016-11-07
Review via email: mp+310205@code.launchpad.net

Commit message

App ID should allow package names with dots.

To post a comment you must log in.
Ted Gould (ted) wrote :

Backporting to vivid. Same review.

review: Approve

Unmerged revisions

93. By Larry Price on 2016-08-04

Adding test

92. By Larry Price on 2016-08-04

Accept '.' in appid for libertine apps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-06-11 21:38:13 +0000
3+++ CMakeLists.txt 2016-11-07 16:40:58 +0000
4@@ -3,7 +3,7 @@
5
6 string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_lower) # Build types should always be lowercase but sometimes they are not.
7
8-if (${cmake_build_type_lower} STREQUAL debug)
9+if ("${cmake_build_type_lower}" STREQUAL "debug")
10 option (werror "Treat warnings as errors." FALSE)
11 else()
12 option (werror "Treat warnings as errors." TRUE)
13@@ -30,7 +30,7 @@
14 include(UseConstantBuilder)
15
16 # Workaround for libexecdir on debian
17-if (EXISTS "/etc/debian_version")
18+if (EXISTS "/etc/debian_version")
19 set(CMAKE_INSTALL_LIBEXECDIR ${CMAKE_INSTALL_LIBDIR})
20 set(CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBEXECDIR}")
21 endif()
22@@ -42,7 +42,7 @@
23 # Since gdbus-codegen does not produce warning-free code
24 # and we use -Werror, only enable these warnings for debug
25 # builds. Drop this once the issue has been fixed and landed.
26-if (${cmake_build_type_lower} STREQUAL debug)
27+if ("${cmake_build_type_lower}" STREQUAL debug)
28 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpedantic")# -Wextra")
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpedantic -Wextra")
30 endif()
31@@ -50,7 +50,7 @@
32 if (${werror})
33 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
34 set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
35-endif()
36+endif()
37
38 pkg_check_modules(UBUNTU_APP_LAUNCH REQUIRED ubuntu-app-launch-2>=0.5)
39 include_directories(${UBUNTU_APP_LAUNCH_INCLUDE_DIRS})
40@@ -115,4 +115,3 @@
41 endif ()
42 add_subdirectory(tests)
43 endif ()
44-
45
46=== modified file 'service/dispatcher.c'
47--- service/dispatcher.c 2015-09-03 21:50:06 +0000
48+++ service/dispatcher.c 2016-11-07 16:40:58 +0000
49@@ -556,7 +556,7 @@
50 g_return_val_if_fail(urldb != NULL, FALSE);
51
52 applicationre = g_regex_new("^application:///([a-zA-Z0-9_\\.-]*)\\.desktop$", 0, 0, NULL);
53- appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
54+ appidre = g_regex_new("^appid://([a-z0-9\\.-]*)/([a-zA-Z0-9-\\.]*)/([a-zA-Z0-9\\.-]*)$", 0, 0, NULL);
55 genericre = g_regex_new("^([a-z][a-z0-9]*):(?://(?:.*@)?([a-zA-Z0-9\\.-]*)(?::[0-9]*)?/?)?(.*)?$", 0, 0, NULL);
56 intentre = g_regex_new("^intent://.*package=([a-zA-Z0-9\\.]*);.*$", 0, 0, NULL);
57
58
59=== modified file 'tests/app-id-test.cc'
60--- tests/app-id-test.cc 2015-05-15 21:24:15 +0000
61+++ tests/app-id-test.cc 2016-11-07 16:40:58 +0000
62@@ -88,6 +88,18 @@
63 g_clear_pointer(&out_appid, g_free);
64 out_url = nullptr;
65
66+ /* App ID with periods */
67+ dispatcher_url_to_appid("appid://container-id/org.canonical.app1/0.0", &out_appid, &out_url);
68+ ASSERT_STREQ("container-id_org.canonical.app1_0.0", out_appid);
69+ EXPECT_EQ(nullptr, out_url);
70+
71+ dispatcher_send_to_app(out_appid, out_url);
72+ EXPECT_STREQ("container-id_org.canonical.app1_0.0", ubuntu_app_launch_mock_get_last_app_id());
73+
74+ ubuntu_app_launch_mock_clear_last_app_id();
75+ g_clear_pointer(&out_appid, g_free);
76+ out_url = nullptr;
77+
78 /* No version at all */
79 dispatcher_url_to_appid("appid://com.test.good/app1", &out_appid, &out_url);
80

Subscribers

People subscribed via source and target branches