[geany/www.geany.org] 0819b0: Fix spurious trailing slash and decode bytes in Pastebin API response

Enrico Tröger git-noreply at xxxxx
Sat May 11 13:15:52 UTC 2019


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Sun, 14 Apr 2019 22:53:31 UTC
Commit:      0819b0be4b720fac047f63d95aef179609bdcb9e
             https://github.com/geany/www.geany.org/commit/0819b0be4b720fac047f63d95aef179609bdcb9e

Log Message:
-----------
Fix spurious trailing slash and decode bytes in Pastebin API response


Modified Paths:
--------------
    pastebin/templates/pastebin/api.html
    pastebin/views.py

Modified: pastebin/templates/pastebin/api.html
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -31,7 +31,8 @@ <h1>API</h1>
         encoded_data,
     )
     response = urllib.request.urlopen(request)
-    print(response.read()[:-1])
+    response_content = response.read()
+    print(response_content.decode())
 
 if __name__ == '__main__':
     paste_code()</pre>


Modified: pastebin/views.py
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -200,7 +200,7 @@ def post(self, request):
 
         site = self._get_site(request)
         absolute_url = snippet.get_absolute_url()
-        result = 'https://%s%s/' % (site.domain, absolute_url)
+        result = 'https://{}{}'.format(site.domain, absolute_url)
         return HttpResponse(result, content_type='text/plain')
 
     # ----------------------------------------------------------------------



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list