mirror of
https://github.com/andrey271192/amnezia_web-PRO.git
synced 2026-09-20 14:42:00 +00:00
fix: ASCII-safe export filenames and trim landing footer
Content-Disposition rejects non-ASCII in Node; sanitize export names. Public landing keeps admin link only; donate links stay in admin UI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
12
server.js
12
server.js
@@ -798,9 +798,17 @@ function parseInterfaceKeyValues(head) {
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Имя файла только из ASCII — иначе Node отклоняет заголовок Content-Disposition. */
|
||||
function safeExportFilenamePart(name, fallback) {
|
||||
const s = String(name || fallback || "client").replace(/[^\w\u0400-\u04FF\-]+/g, "_");
|
||||
return s.slice(0, 80) || "client";
|
||||
const toAsciiToken = (s) =>
|
||||
String(s ?? "")
|
||||
.normalize("NFKD")
|
||||
.replace(/[^\x20-\x7E]/g, "")
|
||||
.replace(/[^a-zA-Z0-9._-]/g, "_")
|
||||
.replace(/_+/g, "_")
|
||||
.replace(/^_|_$/g, "")
|
||||
.slice(0, 80);
|
||||
return toAsciiToken(name) || toAsciiToken(fallback) || "client";
|
||||
}
|
||||
|
||||
function formatExportAllowedIps(lc, fallback = "0.0.0.0/0, ::/0") {
|
||||
|
||||
Reference in New Issue
Block a user