@sfxcode/mongocamp-server-core 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +18 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3966,7 +3966,7 @@ function dateValue(date, mode) {
|
|
|
3966
3966
|
}
|
|
3967
3967
|
return { $date: { $numberLong: String(millis) } };
|
|
3968
3968
|
}
|
|
3969
|
-
function extendedValue(value, mode) {
|
|
3969
|
+
function extendedValue$1(value, mode) {
|
|
3970
3970
|
if (value === null) {
|
|
3971
3971
|
return null;
|
|
3972
3972
|
}
|
|
@@ -3987,7 +3987,7 @@ function extendedValue(value, mode) {
|
|
|
3987
3987
|
return longValue(value, mode);
|
|
3988
3988
|
}
|
|
3989
3989
|
if (Array.isArray(value)) {
|
|
3990
|
-
return value.map((entry) => extendedValue(entry, mode));
|
|
3990
|
+
return value.map((entry) => extendedValue$1(entry, mode));
|
|
3991
3991
|
}
|
|
3992
3992
|
if (value instanceof Date) {
|
|
3993
3993
|
return dateValue(value, mode);
|
|
@@ -4042,7 +4042,7 @@ function extendedValue(value, mode) {
|
|
|
4042
4042
|
return null;
|
|
4043
4043
|
}
|
|
4044
4044
|
function extendedDocument(document, mode) {
|
|
4045
|
-
return Object.fromEntries(Object.entries(document).map(([key, value]) => [key, extendedValue(value, mode)]));
|
|
4045
|
+
return Object.fromEntries(Object.entries(document).map(([key, value]) => [key, extendedValue$1(value, mode)]));
|
|
4046
4046
|
}
|
|
4047
4047
|
function documentToJson(document, mode = DefaultExtendedJsonMode) {
|
|
4048
4048
|
return mode === "plain" ? legacyDocument(document) : extendedDocument(document, mode);
|
|
@@ -7469,6 +7469,20 @@ function registerAuthRoutes(app, context) {
|
|
|
7469
7469
|
});
|
|
7470
7470
|
}
|
|
7471
7471
|
|
|
7472
|
+
function contentDisposition(disposition, filename) {
|
|
7473
|
+
if (/^[\x20-\x7E]*$/.test(filename)) {
|
|
7474
|
+
return `${disposition}; filename=${quoted(filename)}`;
|
|
7475
|
+
}
|
|
7476
|
+
const fallback = filename.normalize("NFKD").replace(/\p{M}/gu, "").replace(/[^\x20-\x7E]/g, "_");
|
|
7477
|
+
return `${disposition}; filename=${quoted(fallback)}; filename*=UTF-8''${extendedValue(filename)}`;
|
|
7478
|
+
}
|
|
7479
|
+
function quoted(text) {
|
|
7480
|
+
return `"${text.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
|
|
7481
|
+
}
|
|
7482
|
+
function extendedValue(text) {
|
|
7483
|
+
return encodeURIComponent(text).replace(/['()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
7484
|
+
}
|
|
7485
|
+
|
|
7472
7486
|
function bucketOf(database, bucket) {
|
|
7473
7487
|
const name = parseCollectionName(bucket);
|
|
7474
7488
|
return { db: databaseOf(database, name), name: name.name };
|
|
@@ -7599,7 +7613,7 @@ function downloadResponse(bucket, document, cacheAge) {
|
|
|
7599
7613
|
headers: {
|
|
7600
7614
|
"content-type": contentType,
|
|
7601
7615
|
"content-length": String(info.length),
|
|
7602
|
-
"content-disposition":
|
|
7616
|
+
"content-disposition": contentDisposition(disposition, info.filename),
|
|
7603
7617
|
"cache-control": `max-age=${cacheAge}`
|
|
7604
7618
|
}
|
|
7605
7619
|
});
|