Skip to content

Commit a47ab99

Browse files
committed
Add URL Pruning for different styles
1 parent 5f621e4 commit a47ab99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

readthedocs/projects/views/public.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def get_context_data(self, **kwargs):
112112
@never_cache
113113
def project_badge(request, project_slug):
114114
"""Return a sweet badge for the project."""
115-
badge_path = 'projects/badges/%s.svg'
115+
style = request.GET.get('style', 'flat')
116+
if style not in ("flat", "plastic", "flat-square", "for-the-badge", "social"):
117+
style = "flat"
118+
badge_path = 'projects/badges/%s-' + style + '.svg'
116119
version_slug = request.GET.get('version', LATEST)
117120
try:
118121
version = Version.objects.public(request.user).get(

0 commit comments

Comments
 (0)