Getting exported theme

main
Bob Mottram 2021-05-28 23:14:44 +01:00
parent 8ff292dc8d
commit 55c3c85cf4
1 changed files with 25 additions and 1 deletions

View File

@ -4147,7 +4147,7 @@ class PubServer(BaseHTTPRequestHandler):
self._redirect_headers(themeDownloadPath,
cookie, callingDomain)
self.server.POSTbusy = False
return
return
# extract all of the text fields into a dict
fields = \
@ -5496,6 +5496,23 @@ class PubServer(BaseHTTPRequestHandler):
None, callingDomain)
self._write(msg)
def _getExportedTheme(self, callingDomain: str, path: str,
baseDir: str, domainFull: str,
debug: bool) -> None:
"""Returns an exported theme zip file
"""
filename = path.split('/exports/', 1)[1]
filename = baseDir + '/exports/' + filename
if os.path.isfile(filename):
with open(filename, 'rb') as fp:
exportBinary = fp.read()
exportType = 'application/zip'
self._set_headers_etag(filename, exportType,
exportBinary, None,
server.domainFull)
self._write(exportBinary)
self._404()
def _getFonts(self, callingDomain: str, path: str,
baseDir: str, debug: bool,
GETstartTime, GETtimings: {}) -> None:
@ -10828,6 +10845,13 @@ class PubServer(BaseHTTPRequestHandler):
GETstartTime, GETtimings):
return
if authorized and '/exports/' in self.path:
self._getExportedTheme(callingDomain, self.path,
self.server.baseDir,
self.server.domainFull,
self.server.debug)
return
# get fonts
if '/fonts/' in self.path:
self._getFonts(callingDomain, self.path,