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:
38
backend/node_modules/@smithy/util-stream/dist-es/headStream.js
generated
vendored
Normal file
38
backend/node_modules/@smithy/util-stream/dist-es/headStream.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Writable } from "stream";
|
||||
import { headStream as headWebStream } from "./headStream.browser";
|
||||
import { isReadableStream } from "./stream-type-check";
|
||||
export const headStream = (stream, bytes) => {
|
||||
if (isReadableStream(stream)) {
|
||||
return headWebStream(stream, bytes);
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
const collector = new Collector();
|
||||
collector.limit = bytes;
|
||||
stream.pipe(collector);
|
||||
stream.on("error", (err) => {
|
||||
collector.end();
|
||||
reject(err);
|
||||
});
|
||||
collector.on("error", reject);
|
||||
collector.on("finish", function () {
|
||||
const bytes = new Uint8Array(Buffer.concat(this.buffers));
|
||||
resolve(bytes);
|
||||
});
|
||||
});
|
||||
};
|
||||
class Collector extends Writable {
|
||||
buffers = [];
|
||||
limit = Infinity;
|
||||
bytesBuffered = 0;
|
||||
_write(chunk, encoding, callback) {
|
||||
this.buffers.push(chunk);
|
||||
this.bytesBuffered += chunk.byteLength ?? 0;
|
||||
if (this.bytesBuffered >= this.limit) {
|
||||
const excess = this.bytesBuffered - this.limit;
|
||||
const tailBuffer = this.buffers[this.buffers.length - 1];
|
||||
this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess);
|
||||
this.emit("finish");
|
||||
}
|
||||
callback();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user