Bug#851296:

2017-10-30 Thread Ville Skyttä
Hm, not a good idea to use git send-email to send to the BTS it seems.
Here are the same patches as attachments.
From 0c43317f342e2aa43207605f17e583da866e7b24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= 
Date: Mon, 30 Oct 2017 21:43:27 +0200
Subject: [PATCH 1/3] Use urlquote_plus instead of urlquote for query string
 data

---
 distro_tracker/vendor/debian/rules.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/distro_tracker/vendor/debian/rules.py b/distro_tracker/vendor/debian/rules.py
index 9a6ed00..16672b3 100644
--- a/distro_tracker/vendor/debian/rules.py
+++ b/distro_tracker/vendor/debian/rules.py
@@ -15,7 +15,7 @@ import re
 import requests
 
 from django import forms
-from django.utils.http import urlencode, urlquote
+from django.utils.http import urlencode, urlquote_plus
 from django.utils.safestring import mark_safe
 from django.conf import settings
 
@@ -263,7 +263,7 @@ def get_developer_information_url(developer_email):
 Return a URL to extra information about a developer, by email address.
 """
 URL_TEMPLATE = 'https://qa.debian.org/developer.php?email={email}'
-return URL_TEMPLATE.format(email=urlquote(developer_email))
+return URL_TEMPLATE.format(email=urlquote_plus(developer_email))
 
 
 def get_external_version_information_urls(package_name):
@@ -328,7 +328,7 @@ def _add_dmd_entry(extra, email):
 'display': 'DMD',
 'description': 'UDD\'s Debian Maintainer Dashboard',
 'link': 'https://udd.debian.org/dmd/?{email}#todo'.format(
-email=urlquote(email)
+email=urlquote_plus(email)
 )
 })
 
-- 
2.14.1

From 6abc4e4e6c02554e8f79d077085ce8741442c2c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= 
Date: Mon, 30 Oct 2017 21:46:40 +0200
Subject: [PATCH 2/3] Missing URL encoding fixes

---
 .../accounts/templates/accounts/subscriptions.html   |  6 +++---
 .../accounts/templates/accounts/user-widget.html |  2 +-
 .../core/templates/core/edit-team-membership.html|  6 +++---
 distro_tracker/core/templates/core/news_list.html|  2 +-
 distro_tracker/core/templates/core/package.html  |  2 +-
 distro_tracker/core/templates/core/team-list.html|  2 +-
 distro_tracker/core/templates/core/team-manage.html  |  2 +-
 distro_tracker/core/templates/core/team.html |  2 +-
 distro_tracker/vendor/debian/tracker_panels.py   | 20 +---
 9 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/distro_tracker/accounts/templates/accounts/subscriptions.html b/distro_tracker/accounts/templates/accounts/subscriptions.html
index cc0243d..02fab38 100644
--- a/distro_tracker/accounts/templates/accounts/subscriptions.html
+++ b/distro_tracker/accounts/templates/accounts/subscriptions.html
@@ -30,7 +30,7 @@
 Unsubscribe all
 
 {% endif %}
-
+
 Modify keywords
 
 
@@ -77,7 +77,7 @@
 		
 		
 		
-			
+			
 			Modify keywords
 			{% csrf_token %}
 			
@@ -123,7 +123,7 @@
 		
 		
 			Modify keywords
-			Manage subscriptions
+			Manage subscriptions
 			{% if membership.muted %}
 			{% csrf_token %}
 			{% else %}
diff --git a/distro_tracker/accounts/templates/accounts/user-widget.html b/distro_tracker/accounts/templates/accounts/user-widget.html
index a5b0247..5838afa 100644
--- a/distro_tracker/accounts/templates/accounts/user-widget.html
+++ b/distro_tracker/accounts/templates/accounts/user-widget.html
@@ -1,7 +1,7 @@
 {% if user.is_authenticated %}
 Profile
 |
-Log out
+Log out
 {% else %}
 Register
 |
diff --git a/distro_tracker/core/templates/core/edit-team-membership.html b/distro_tracker/core/templates/core/edit-team-membership.html
index 06125ed..745aed2 100644
--- a/distro_tracker/core/templates/core/edit-team-membership.html
+++ b/distro_tracker/core/templates/core/edit-team-membership.html
@@ -35,14 +35,14 @@
 {% csrf_token %}
 
 
-
+
 Unmute
 
 {% else %}
 {% csrf_token %}
 
 
-
+
 Mute
 
 {% endif %}
@@ -70,7 +70,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/news_list.html b/distro_tracker/core/templates/core/news_list.html
index c13952d..4f139ab 100644
--- a/distro_tracker/core/templates/core/news_list.html
+++ b/distro_tracker/core/templates/core/news_list.html
@@ -25,7 +25,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/package.html b/distro_tracker/core/templates/core/package.html
index 2253794..1f29d33 100644
--- a/distro_tracker/core/templates/core/package.html
+++ 

Bug#851296: [PATCH 3/3] TransitionsPanel: URL quote in template, not variables

2017-10-30 Thread Ville Skyttä
---
 distro_tracker/vendor/debian/templates/debian/transitions-panel.html | 2 +-
 distro_tracker/vendor/debian/tracker_panels.py   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/distro_tracker/vendor/debian/templates/debian/transitions-panel.html 
b/distro_tracker/vendor/debian/templates/debian/transitions-panel.html
index e14453d..56f170c 100644
--- a/distro_tracker/vendor/debian/templates/debian/transitions-panel.html
+++ b/distro_tracker/vendor/debian/templates/debian/transitions-panel.html
@@ -41,7 +41,7 @@
 
 {% if panel.context.excuses %}
 
-https://qa.debian.org/excuses.php?package={{ 
panel.context.package_name }}">excuses:
+https://qa.debian.org/excuses.php?package={{ 
panel.context.package_name|urlencode:'' }}">excuses:
 
   {% for excuse in panel.context.excuses %}
   {{ excuse }}
diff --git a/distro_tracker/vendor/debian/tracker_panels.py 
b/distro_tracker/vendor/debian/tracker_panels.py
index 9569969..17f90b2 100644
--- a/distro_tracker/vendor/debian/tracker_panels.py
+++ b/distro_tracker/vendor/debian/tracker_panels.py
@@ -258,7 +258,7 @@ class TransitionsPanel(BasePanel):
 return {
 'transitions': self.package.package_transitions.all(),
 'excuses': excuses,
-'package_name': urlquote(self.package.name),
+'package_name': self.package.name,
 }
 
 @property
-- 
2.14.1



Bug#851296:

2017-10-30 Thread Ville Skyttä
Tags: patch

This set of patches should fix the mentioned issues and more of the
kind I could find with some grepping.



Bug#851296: [PATCH 2/3] Missing URL encoding fixes

2017-10-30 Thread Ville Skyttä
---
 .../accounts/templates/accounts/subscriptions.html   |  6 +++---
 .../accounts/templates/accounts/user-widget.html |  2 +-
 .../core/templates/core/edit-team-membership.html|  6 +++---
 distro_tracker/core/templates/core/news_list.html|  2 +-
 distro_tracker/core/templates/core/package.html  |  2 +-
 distro_tracker/core/templates/core/team-list.html|  2 +-
 distro_tracker/core/templates/core/team-manage.html  |  2 +-
 distro_tracker/core/templates/core/team.html |  2 +-
 distro_tracker/vendor/debian/tracker_panels.py   | 20 +---
 9 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/distro_tracker/accounts/templates/accounts/subscriptions.html 
b/distro_tracker/accounts/templates/accounts/subscriptions.html
index cc0243d..02fab38 100644
--- a/distro_tracker/accounts/templates/accounts/subscriptions.html
+++ b/distro_tracker/accounts/templates/accounts/subscriptions.html
@@ -30,7 +30,7 @@
 Unsubscribe all
 
 {% endif %}
-
+
 Modify keywords
 
 
@@ -77,7 +77,7 @@



-   
+   
Modify keywords
{% 
csrf_token %}

@@ -123,7 +123,7 @@


Modify keywords
-   Manage subscriptions
+   Manage subscriptions
{% if membership.muted %}
{% 
csrf_token %}
{% else %}
diff --git a/distro_tracker/accounts/templates/accounts/user-widget.html 
b/distro_tracker/accounts/templates/accounts/user-widget.html
index a5b0247..5838afa 100644
--- a/distro_tracker/accounts/templates/accounts/user-widget.html
+++ b/distro_tracker/accounts/templates/accounts/user-widget.html
@@ -1,7 +1,7 @@
 {% if user.is_authenticated %}
 Profile
 |
-Log out
+Log out
 {% else %}
 Register
 |
diff --git a/distro_tracker/core/templates/core/edit-team-membership.html 
b/distro_tracker/core/templates/core/edit-team-membership.html
index 06125ed..745aed2 100644
--- a/distro_tracker/core/templates/core/edit-team-membership.html
+++ b/distro_tracker/core/templates/core/edit-team-membership.html
@@ -35,14 +35,14 @@
 {% csrf_token %}
 
 
-
+
 Unmute
 
 {% else %}
 {% csrf_token %}
 
 
-
+
 Mute
 
 {% endif %}
@@ -70,7 +70,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/news_list.html 
b/distro_tracker/core/templates/core/news_list.html
index c13952d..4f139ab 100644
--- a/distro_tracker/core/templates/core/news_list.html
+++ b/distro_tracker/core/templates/core/news_list.html
@@ -25,7 +25,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/package.html 
b/distro_tracker/core/templates/core/package.html
index 2253794..1f29d33 100644
--- a/distro_tracker/core/templates/core/package.html
+++ b/distro_tracker/core/templates/core/package.html
@@ -33,7 +33,7 @@


{% else %}
-   
+   
{% endif %}
 
  Subscribe
diff --git a/distro_tracker/core/templates/core/team-list.html 
b/distro_tracker/core/templates/core/team-list.html
index ae1d1cc..4192515 100644
--- a/distro_tracker/core/templates/core/team-list.html
+++ b/distro_tracker/core/templates/core/team-list.html
@@ -27,7 +27,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/team-manage.html 
b/distro_tracker/core/templates/core/team-manage.html
index c61eb8b..4cf0f7b 100644
--- a/distro_tracker/core/templates/core/team-manage.html
+++ b/distro_tracker/core/templates/core/team-manage.html
@@ -31,7 +31,7 @@
 
 
 {% for page in page_obj.paginator.page_range %}
-{{ page }}
+{{ page }}
 {% endfor %}
 
 
diff --git a/distro_tracker/core/templates/core/team.html 
b/distro_tracker/core/templates/core/team.html
index 722e243..de338de 100644
--- a/distro_tracker/core/templates/core/team.html
+++ b/distro_tracker/core/templates/core/team.html
@@ -116,7 +116,7 @@
 {% endif %}
{% if user_member_of_team %}

-   {% octicon 'trashcan' 'remove package 
from team' %}
+   {% octicon 'trashcan' 'remove 
package from team' %}

{% endif %}
   

Bug#851296: [PATCH 1/3] Use urlquote_plus instead of urlquote for query string data

2017-10-30 Thread Ville Skyttä
---
 distro_tracker/vendor/debian/rules.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/distro_tracker/vendor/debian/rules.py 
b/distro_tracker/vendor/debian/rules.py
index 9a6ed00..16672b3 100644
--- a/distro_tracker/vendor/debian/rules.py
+++ b/distro_tracker/vendor/debian/rules.py
@@ -15,7 +15,7 @@ import re
 import requests
 
 from django import forms
-from django.utils.http import urlencode, urlquote
+from django.utils.http import urlencode, urlquote_plus
 from django.utils.safestring import mark_safe
 from django.conf import settings
 
@@ -263,7 +263,7 @@ def get_developer_information_url(developer_email):
 Return a URL to extra information about a developer, by email address.
 """
 URL_TEMPLATE = 'https://qa.debian.org/developer.php?email={email}'
-return URL_TEMPLATE.format(email=urlquote(developer_email))
+return URL_TEMPLATE.format(email=urlquote_plus(developer_email))
 
 
 def get_external_version_information_urls(package_name):
@@ -328,7 +328,7 @@ def _add_dmd_entry(extra, email):
 'display': 'DMD',
 'description': 'UDD\'s Debian Maintainer Dashboard',
 'link': 'https://udd.debian.org/dmd/?{email}#todo'.format(
-email=urlquote(email)
+email=urlquote_plus(email)
 )
 })
 
-- 
2.14.1



Bug#851296: tracker.debian.org: broken links for packages containing "+" symbol

2017-01-13 Thread Simon McVittie
Package: tracker.debian.org
Severity: normal

A package with a + in its name, like
, has a broken link for
popcon:
 doesn't work,
because + is interpreted as space in the query string. The correct link
would be .

Other broken links seen for the same reason:

/accounts/logout/?next=/pkg/libgetopt++ (when logged-in)
https://qa.debian.org/madison.php?package=libgetopt++

Package names in query-strings should be escaped with urllib.quote_plus()
instead of urllib.quote(). The "buildd logs" link seems to do this
correctly, and so do the BTS links.

(It would also be OK to use quote_plus in many other contexts, although
it might be necessary to use quote_plus(..., safe='/') if the string
being substituted includes a directory name.)