fix: fix chunk

This commit is contained in:
2025-03-31 21:22:13 +08:00
parent e0ac1b7d27
commit 466ac1bcf0
4 changed files with 15 additions and 11 deletions

View File

@@ -134,6 +134,15 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
// Clean up the final file
fs.unlinkSync(finalFilePath);
const downloadBase = '/api/s1/share';
const uploadResult = {
name: relativePath,
path: `${downloadBase}/${minioPath}`,
appKey,
version,
username,
};
if (!noCheckAppFiles) {
// Notify the app
const r = await app.call({
@@ -148,17 +157,11 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
},
},
});
const downloadBase = '/api/s1/share';
const data: any = {
code: r.code,
data: {
app: r.body,
upload: [
{
name: relativePath,
path: `${downloadBase}/${minioPath}`,
},
],
upload: [uploadResult],
},
};
if (r.message) {
@@ -172,7 +175,7 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
res.end(
JSON.stringify({
message: 'Chunk uploaded successfully',
data: { chunkIndex, totalChunks },
data: { chunkIndex, totalChunks, upload: [uploadResult] },
}),
);
}
@@ -180,6 +183,7 @@ router.post('/api/s1/resources/upload/chunk', async (req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(
JSON.stringify({
code: 200,
message: 'Chunk uploaded successfully',
data: {
chunkIndex,