MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / download_backup

Method download_backup

utils.py:282–294  ·  view source on GitHub ↗
(self, handler)

Source from the content-addressed store, hash-verified

280 handler.wfile.write(json.dumps({"status": "error", "message": str(e)}).encode('utf-8'))
281
282 def download_backup(self, handler):
283 query = unquote(handler.path.split('?filename=')[1])
284 backup_path = os.path.join(self.shared_data.backupdir, query)
285 if os.path.isfile(backup_path):
286 handler.send_response(200)
287 handler.send_header("Content-Disposition", f'attachment; filename="{os.path.basename(backup_path)}"')
288 handler.send_header("Content-type", "application/zip")
289 handler.end_headers()
290 with open(backup_path, 'rb') as file:
291 handler.wfile.write(file.read())
292 else:
293 handler.send_response(404)
294 handler.end_headers()
295
296 def serve_credentials_data(self, handler):
297 try:

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected