mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
ready
This commit is contained in:
@@ -337,11 +337,11 @@ exports.getAsset = async (req, res) => {
|
||||
// └─────────────────────────────────────────────────────────────────────────┘
|
||||
//
|
||||
// Shared by the single-file POST / and the multi-file POST /batch routes.
|
||||
// `requireVideoThumbnail` is false for batch uploads — a bulk drop has no
|
||||
// per-file thumbnail step, so videos land with thumbnail_url null and pick
|
||||
// one up later via the existing "thumbnail-only" path in updateAsset().
|
||||
// Thumbnails are optional for both video and audio — a video/audio asset can
|
||||
// land with thumbnail_url null and pick one up later via the existing
|
||||
// "thumbnail-only" path in updateAsset().
|
||||
//
|
||||
async function createAssetFromUpload({ file, thumbFile, body, user, requireVideoThumbnail = true, uploadId }) {
|
||||
async function createAssetFromUpload({ file, thumbFile, body, user, uploadId }) {
|
||||
const uploadedFiles = []; // [{ key, provider }]
|
||||
|
||||
try {
|
||||
@@ -367,10 +367,6 @@ async function createAssetFromUpload({ file, thumbFile, body, user, requireVideo
|
||||
const checksum = file.buffer ? resolveChecksum(file.buffer) : null;
|
||||
const usesProvider = ["chibisafe", "s3"].includes(storage_provider);
|
||||
|
||||
if (file_type === "video" && requireVideoThumbnail && !thumbFile) {
|
||||
throw Object.assign(new Error("A thumbnail image is required for video uploads."), { status: 400 });
|
||||
}
|
||||
|
||||
if (usesProvider && !file.buffer) {
|
||||
throw Object.assign(new Error("File buffer is required. Ensure multer uses memoryStorage."), { status: 400 });
|
||||
}
|
||||
@@ -575,7 +571,6 @@ exports.uploadAssetsBatch = async (req, res) => {
|
||||
createdBy,
|
||||
},
|
||||
user: req.user,
|
||||
requireVideoThumbnail: false,
|
||||
});
|
||||
results.push({ originalname: file.originalname, success: true, data: asset });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user