Fix sidebar site download with utf8 title
This commit is contained in:
parent
416f563261
commit
1567fb745d
1 changed files with 5 additions and 2 deletions
|
@ -6,6 +6,8 @@ import math
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
import io
|
import io
|
||||||
|
import urllib
|
||||||
|
import urllib.parse
|
||||||
|
|
||||||
import gevent
|
import gevent
|
||||||
|
|
||||||
|
@ -66,9 +68,10 @@ class UiRequestPlugin(object):
|
||||||
if not site:
|
if not site:
|
||||||
return self.error404("Site not found")
|
return self.error404("Site not found")
|
||||||
|
|
||||||
title = site.content_manager.contents.get("content.json", {}).get("title", "").encode('ascii', 'ignore')
|
title = site.content_manager.contents.get("content.json", {}).get("title", "")
|
||||||
filename = "%s-backup-%s.zip" % (title, time.strftime("%Y-%m-%d_%H_%M"))
|
filename = "%s-backup-%s.zip" % (title, time.strftime("%Y-%m-%d_%H_%M"))
|
||||||
self.sendHeader(content_type="application/zip", extra_headers={'Content-Disposition': 'attachment; filename="%s"' % filename})
|
filename_quoted = urllib.parse.quote(filename)
|
||||||
|
self.sendHeader(content_type="application/zip", extra_headers={'Content-Disposition': 'attachment; filename="%s"' % filename_quoted})
|
||||||
|
|
||||||
return self.streamZip(site.storage.getPath("."))
|
return self.streamZip(site.storage.getPath("."))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue