fix: gif file not returning file url.
This commit is contained in:
parent
018d9a7b8d
commit
8a8fbccfaa
@ -49,24 +49,26 @@ export async function getRunsData(run_id: string, user?: APIKeyUserType) {
|
|||||||
for (let i = 0; i < data.outputs.length; i++) {
|
for (let i = 0; i < data.outputs.length; i++) {
|
||||||
const output = data.outputs[i];
|
const output = data.outputs[i];
|
||||||
|
|
||||||
if (output.data?.images !== undefined) {
|
if (output.data?.images !== undefined)
|
||||||
for (let j = 0; j < output.data?.images.length; j++) {
|
replaceUrls(output.data?.images, data.id);
|
||||||
const element = output.data?.images[j];
|
|
||||||
element.url = replaceCDNUrl(
|
if (output.data?.files !== undefined)
|
||||||
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${data.id}/${element.filename}`
|
replaceUrls(output.data?.files, data.id);
|
||||||
);
|
|
||||||
}
|
if (output.data?.gifs !== undefined)
|
||||||
} else if (output.data?.files !== undefined) {
|
replaceUrls(output.data?.gifs, data.id);
|
||||||
for (let j = 0; j < output.data?.files.length; j++) {
|
|
||||||
const element = output.data?.files[j];
|
|
||||||
element.url = replaceCDNUrl(
|
|
||||||
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${data.id}/${element.filename}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replaceUrls(dataType: any[], dataId: string) {
|
||||||
|
for (let j = 0; j < dataType.length; j++) {
|
||||||
|
const element = dataType[j];
|
||||||
|
element.url = replaceCDNUrl(
|
||||||
|
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${dataId}/${element.filename}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user