fix: fix chunk
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user