fix: 修复配额说明重复和undefined问题
- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit - 删除重复的旧配额说明块,保留新的当前配额设置显示 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
73
backend/node_modules/@aws-sdk/middleware-ssec/dist-cjs/index.js
generated
vendored
Normal file
73
backend/node_modules/@aws-sdk/middleware-ssec/dist-cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
'use strict';
|
||||
|
||||
function ssecMiddleware(options) {
|
||||
return (next) => async (args) => {
|
||||
const input = { ...args.input };
|
||||
const properties = [
|
||||
{
|
||||
target: "SSECustomerKey",
|
||||
hash: "SSECustomerKeyMD5",
|
||||
},
|
||||
{
|
||||
target: "CopySourceSSECustomerKey",
|
||||
hash: "CopySourceSSECustomerKeyMD5",
|
||||
},
|
||||
];
|
||||
for (const prop of properties) {
|
||||
const value = input[prop.target];
|
||||
if (value) {
|
||||
let valueForHash;
|
||||
if (typeof value === "string") {
|
||||
if (isValidBase64EncodedSSECustomerKey(value, options)) {
|
||||
valueForHash = options.base64Decoder(value);
|
||||
}
|
||||
else {
|
||||
valueForHash = options.utf8Decoder(value);
|
||||
input[prop.target] = options.base64Encoder(valueForHash);
|
||||
}
|
||||
}
|
||||
else {
|
||||
valueForHash = ArrayBuffer.isView(value)
|
||||
? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
||||
: new Uint8Array(value);
|
||||
input[prop.target] = options.base64Encoder(valueForHash);
|
||||
}
|
||||
const hash = new options.md5();
|
||||
hash.update(valueForHash);
|
||||
input[prop.hash] = options.base64Encoder(await hash.digest());
|
||||
}
|
||||
}
|
||||
return next({
|
||||
...args,
|
||||
input,
|
||||
});
|
||||
};
|
||||
}
|
||||
const ssecMiddlewareOptions = {
|
||||
name: "ssecMiddleware",
|
||||
step: "initialize",
|
||||
tags: ["SSE"],
|
||||
override: true,
|
||||
};
|
||||
const getSsecPlugin = (config) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.add(ssecMiddleware(config), ssecMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
function isValidBase64EncodedSSECustomerKey(str, options) {
|
||||
const base64Regex = /^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
||||
if (!base64Regex.test(str))
|
||||
return false;
|
||||
try {
|
||||
const decodedBytes = options.base64Decoder(str);
|
||||
return decodedBytes.length === 32;
|
||||
}
|
||||
catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
exports.getSsecPlugin = getSsecPlugin;
|
||||
exports.isValidBase64EncodedSSECustomerKey = isValidBase64EncodedSSECustomerKey;
|
||||
exports.ssecMiddleware = ssecMiddleware;
|
||||
exports.ssecMiddlewareOptions = ssecMiddlewareOptions;
|
||||
Reference in New Issue
Block a user