mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix copy error (#777)
This commit is contained in:
1 parent
18faad5510
commit
6454e2ed96
2 files changed
+2
-1
No files matched your search
@@ -106,7 +106,7 @@ export class StorageModel {
|
||||
// Make sure id is not used
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
while (await StorageModel.coll.findOne({ _id })) _id = StorageModel.generateId(extname(dst));
|
||||
const result = await storage.copy(value._id, dst);
|
||||
const result = await storage.copy(value._id, _id);
|
||||
const { metaData, size, etag } = await storage.getMeta(_id);
|
||||
await StorageModel.coll.insertOne({
|
||||
_id, meta: metaData, path: dst, size, etag, lastModified: new Date(), owner: value.owner || 1,
|
||||
|
||||
@@ -335,6 +335,7 @@ class LocalStorageService {
|
||||
async copy(src: string, target: string) {
|
||||
src = resolve(this.dir, convertPath(src));
|
||||
target = resolve(this.dir, convertPath(target));
|
||||
await ensureDir(dirname(target));
|
||||
await copyFile(src, target);
|
||||
return { etag: target, lastModified: new Date() };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user