Merge lp:~mardy/signon-ui/url-slash-1173926 into lp:signon-ui

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 142
Merged at revision: 142
Proposed branch: lp:~mardy/signon-ui/url-slash-1173926
Merge into: lp:signon-ui
Diff against target: 36 lines (+10/-2)
1 file modified
src/browser-request.cpp (+10/-2)
To merge this branch: bzr merge lp:~mardy/signon-ui/url-slash-1173926
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Online Accounts Pending
Review via email: mp+278318@code.launchpad.net

Commit message

Strip trailing "/" when comparing URLs

Fixes an issue arising when our callback URL is http://example.com and we get redirected to http://example.com/

Description of the change

Strip trailing "/" when comparing URLs

Fixes an issue arising when our callback URL is http://example.com and we get redirected to http://example.com/

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/browser-request.cpp'
2--- src/browser-request.cpp 2014-04-10 10:40:35 +0000
3+++ src/browser-request.cpp 2015-11-23 13:42:53 +0000
4@@ -76,6 +76,14 @@
5 static const QString keyAllowedSchemes = QString("AllowedSchemes");
6 static const QString keyIgnoreSslErrors = QString("IgnoreSslErrors");
7
8+static bool pathsAreEqual(const QString &p1, const QString &p2)
9+{
10+ static QRegExp regExp("/*$");
11+ QString p1copy(p1);
12+ QString p2copy(p2);
13+ return p1copy.remove(regExp) == p2copy.remove(regExp);
14+}
15+
16 class WebPage: public QWebPage
17 {
18 Q_OBJECT
19@@ -128,7 +136,7 @@
20 * If this behaviour is not desired for some requests, then just avoid
21 * calling setFinalUrl() */
22 if (url.host() == m_finalUrl.host() &&
23- url.path() == m_finalUrl.path()) {
24+ pathsAreEqual(url.path(), m_finalUrl.path())) {
25 Q_EMIT finalUrlReached(url);
26 return false;
27 }
28@@ -337,7 +345,7 @@
29 m_failTimer.stop();
30
31 if (url.host() == finalUrl.host() &&
32- url.path() == finalUrl.path()) {
33+ pathsAreEqual(url.path(), finalUrl.path())) {
34 responseUrl = url;
35 if (q->embeddedUi() || !m_dialog->isVisible()) {
36 /* Do not show the notification page. */

Subscribers

People subscribed via source and target branches

to all changes: