- 在editStorageForm中初始化oss_storage_quota_value和oss_quota_unit - 删除重复的旧配额说明块,保留新的当前配额设置显示 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
30 lines
986 B
JavaScript
30 lines
986 B
JavaScript
import { escapeUri } from "@smithy/util-uri-escape";
|
|
import { SIGNATURE_HEADER } from "./constants";
|
|
export const getCanonicalQuery = ({ query = {} }) => {
|
|
const keys = [];
|
|
const serialized = {};
|
|
for (const key of Object.keys(query)) {
|
|
if (key.toLowerCase() === SIGNATURE_HEADER) {
|
|
continue;
|
|
}
|
|
const encodedKey = escapeUri(key);
|
|
keys.push(encodedKey);
|
|
const value = query[key];
|
|
if (typeof value === "string") {
|
|
serialized[encodedKey] = `${encodedKey}=${escapeUri(value)}`;
|
|
}
|
|
else if (Array.isArray(value)) {
|
|
serialized[encodedKey] = value
|
|
.slice(0)
|
|
.reduce((encoded, value) => encoded.concat([`${encodedKey}=${escapeUri(value)}`]), [])
|
|
.sort()
|
|
.join("&");
|
|
}
|
|
}
|
|
return keys
|
|
.sort()
|
|
.map((key) => serialized[key])
|
|
.filter((serialized) => serialized)
|
|
.join("&");
|
|
};
|