[FEATURE] Allow folder uploads
This commit is contained in:
parent
b15f616adb
commit
17c1d68a63
2 changed files with 7 additions and 3 deletions
|
@ -2,7 +2,8 @@ import ftp from "basic-ftp";
|
|||
import { ERR } from "../util/logging.js";
|
||||
import { getServerAssets } from "./k8s-server-control.js";
|
||||
import ExpressClientError from "../util/ExpressClientError.js";
|
||||
import { Readable, Writable, Transform } from "node:stream";
|
||||
import { Readable, Transform } from "node:stream";
|
||||
import { dirname, basename } from "node:path";
|
||||
|
||||
const namespace = process.env.MCL_SERVER_NAMESPACE;
|
||||
|
||||
|
@ -82,7 +83,8 @@ export async function uploadServerItem(serverSpec, file) {
|
|||
const { path } = serverSpec;
|
||||
pathSecurityCheck(path);
|
||||
await useServerFtp(serverSpec, async (c) => {
|
||||
await c.uploadFrom(fileStream, path);
|
||||
await c.ensureDir(dirname(path));
|
||||
await c.uploadFrom(fileStream, basename(path));
|
||||
}).catch(handleError);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue