mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: file_upload: add metadata header
This commit is contained in:
1 parent
a648d51969
commit
f1436a366c
2 files changed
+2
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.17.7",
|
"version": "3.17.8",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class StorageModel {
|
|||||||
// Make sure id is not used
|
// Make sure id is not used
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
while (await StorageModel.coll.findOne({ _id })) _id = `${nanoid(3)}/${nanoid()}${extname(path)}`;
|
while (await StorageModel.coll.findOne({ _id })) _id = `${nanoid(3)}/${nanoid()}${extname(path)}`;
|
||||||
await storage.put(_id, file);
|
await storage.put(_id, file, meta);
|
||||||
const { metaData, size, etag } = await storage.getMeta(_id);
|
const { metaData, size, etag } = await storage.getMeta(_id);
|
||||||
await StorageModel.coll.insertOne({
|
await StorageModel.coll.insertOne({
|
||||||
_id, meta: metaData, path, size, etag, lastModified: new Date(), owner,
|
_id, meta: metaData, path, size, etag, lastModified: new Date(), owner,
|
||||||
|
|||||||
Reference in new issue
Block a user