s3db.js 7.4.0 → 7.4.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/s3db.cjs.js +30 -2
- package/dist/s3db.cjs.min.js +1 -1
- package/dist/s3db.es.js +30 -2
- package/dist/s3db.es.min.js +1 -1
- package/dist/s3db.iife.js +30 -2
- package/dist/s3db.iife.min.js +1 -1
- package/package.json +1 -1
- package/src/client.class.js +41 -1
package/dist/s3db.iife.js
CHANGED
|
@@ -9641,7 +9641,13 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
9641
9641
|
if (metadata) {
|
|
9642
9642
|
for (const [k, v] of Object.entries(metadata)) {
|
|
9643
9643
|
const validKey = String(k).replace(/[^a-zA-Z0-9\-_]/g, "_");
|
|
9644
|
-
|
|
9644
|
+
const stringValue = String(v);
|
|
9645
|
+
const hasSpecialChars = /[^\x00-\x7F]/.test(stringValue);
|
|
9646
|
+
if (hasSpecialChars) {
|
|
9647
|
+
stringMetadata[validKey] = Buffer.from(stringValue, "utf8").toString("base64");
|
|
9648
|
+
} else {
|
|
9649
|
+
stringMetadata[validKey] = stringValue;
|
|
9650
|
+
}
|
|
9645
9651
|
}
|
|
9646
9652
|
}
|
|
9647
9653
|
const options = {
|
|
@@ -9678,6 +9684,28 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
9678
9684
|
let response, error;
|
|
9679
9685
|
try {
|
|
9680
9686
|
response = await this.sendCommand(new clientS3.GetObjectCommand(options));
|
|
9687
|
+
if (response.Metadata) {
|
|
9688
|
+
const decodedMetadata = {};
|
|
9689
|
+
for (const [key2, value] of Object.entries(response.Metadata)) {
|
|
9690
|
+
if (typeof value === "string") {
|
|
9691
|
+
try {
|
|
9692
|
+
const decoded = Buffer.from(value, "base64").toString("utf8");
|
|
9693
|
+
const hasSpecialChars = /[^\x00-\x7F]/.test(decoded);
|
|
9694
|
+
const isValidBase64 = Buffer.from(decoded, "utf8").toString("base64") === value;
|
|
9695
|
+
if (isValidBase64 && hasSpecialChars && decoded !== value) {
|
|
9696
|
+
decodedMetadata[key2] = decoded;
|
|
9697
|
+
} else {
|
|
9698
|
+
decodedMetadata[key2] = value;
|
|
9699
|
+
}
|
|
9700
|
+
} catch (decodeError) {
|
|
9701
|
+
decodedMetadata[key2] = value;
|
|
9702
|
+
}
|
|
9703
|
+
} else {
|
|
9704
|
+
decodedMetadata[key2] = value;
|
|
9705
|
+
}
|
|
9706
|
+
}
|
|
9707
|
+
response.Metadata = decodedMetadata;
|
|
9708
|
+
}
|
|
9681
9709
|
return response;
|
|
9682
9710
|
} catch (err) {
|
|
9683
9711
|
error = err;
|
|
@@ -13268,7 +13296,7 @@ ${JSON.stringify(validation, null, 2)}`,
|
|
|
13268
13296
|
super();
|
|
13269
13297
|
this.version = "1";
|
|
13270
13298
|
this.s3dbVersion = (() => {
|
|
13271
|
-
const [ok, err, version] = try_fn_default(() => true ? "7.
|
|
13299
|
+
const [ok, err, version] = try_fn_default(() => true ? "7.4.1" : "latest");
|
|
13272
13300
|
return ok ? version : "latest";
|
|
13273
13301
|
})();
|
|
13274
13302
|
this.resources = {};
|