enable b2 folder upload

This commit is contained in:
SrGooglo 2025-01-25 19:44:52 +00:00
parent 7b6d32a8a9
commit 738268e31d

View File

@ -92,26 +92,24 @@ export default async ({
try { try {
switch (service) { switch (service) {
case "b2": case "b2":
if (isDirectory) {
throw new OperationError(500, "B2 storage does not support directory upload. yet...")
}
if (!global.b2Storage) { if (!global.b2Storage) {
throw new OperationError(500, "B2 storage not configured on environment, unsupported service. Please use `standard` service.") throw new OperationError(500, "B2 storage not configured on environment, unsupported service. Please use `standard` service.")
} }
result = await B2Upload({ result = await B2Upload({
source, source: isDirectory ? path.dirname(source) : source,
remotePath, remotePath: remotePath,
metadata, metadata: metadata,
isDirectory, isDirectory: isDirectory,
targetFilename: isDirectory ? path.basename(source) : null,
}) })
break break
case "standard": case "standard":
result = await StandardUpload({ result = await StandardUpload({
source: isDirectory ? path.dirname(source) : source, source: isDirectory ? path.dirname(source) : source,
remotePath, remotePath: remotePath,
metadata, metadata: metadata,
isDirectory, isDirectory: isDirectory,
targetFilename: isDirectory ? path.basename(source) : null, targetFilename: isDirectory ? path.basename(source) : null,
}) })
break break