Bump version to v2.7.2 after migrate filename fix.

This commit is contained in:
orohi
2026-08-09 17:46:14 +03:00
parent b3c7d91419
commit 01196c066a
+9 -3
View File
@@ -103,7 +103,7 @@ else:
application_path = os.path.dirname(__file__) application_path = os.path.dirname(__file__)
DATA_FILE = os.path.join(application_path, 'data.json') # legacy JSON; used only for one-shot import / export DATA_FILE = os.path.join(application_path, 'data.json') # legacy JSON; used only for one-shot import / export
CURRENT_VERSION = "v2.7.1" CURRENT_VERSION = "v2.7.2"
RELEASES_REPO_URL = repo_url() RELEASES_REPO_URL = repo_url()
RELEASES_API_LATEST = api_latest_url() RELEASES_API_LATEST = api_latest_url()
BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin')) BIN_DIR = os.environ.get('TUNNEL_BIN_DIR', os.path.join(application_path, 'bin'))
@@ -4205,13 +4205,19 @@ async def api_server_migrate_export(
zip_bytes, summary = await asyncio.to_thread(_do_export) zip_bytes, summary = await asyncio.to_thread(_do_export)
stamp = datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%SZ') stamp = datetime.now(timezone.utc).strftime('%Y%m%dT%H%M%SZ')
safe_name = re.sub(r'[^\w.-]+', '_', server.get('name') or server.get('host') or 'server') safe_name = _ascii_filename_component(
server.get('name') or server.get('host') or 'server',
fallback='server',
)
filename = f'amnezia-migrate-{safe_name}-{stamp}.zip' filename = f'amnezia-migrate-{safe_name}-{stamp}.zip'
headers = { headers = {
'Content-Disposition': f'attachment; filename="{filename}"', 'Content-Disposition': f'attachment; filename="{filename}"',
'X-Migrate-Users': str(summary.get('users', 0)), 'X-Migrate-Users': str(summary.get('users', 0)),
'X-Migrate-Connections': str(summary.get('connections', 0)), 'X-Migrate-Connections': str(summary.get('connections', 0)),
'X-Migrate-Protocols': ','.join(summary.get('protocols') or []), 'X-Migrate-Protocols': ','.join(
_ascii_filename_component(p, fallback='proto')
for p in (summary.get('protocols') or [])
),
} }
return StreamingResponse(io.BytesIO(zip_bytes), media_type='application/zip', headers=headers) return StreamingResponse(io.BytesIO(zip_bytes), media_type='application/zip', headers=headers)
except Exception as e: except Exception as e: