Reset state afecter chunked upload

This commit is contained in:
SebClem 2024-07-12 14:33:11 +02:00
parent 6f20b97488
commit 9a62814c38
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50

View File

@ -414,6 +414,12 @@ export async function chunkedUpload(
logger.debug("Chunked upload funished, assembling chunks."); logger.debug("Chunked upload funished, assembling chunks.");
try { try {
await assembleChunkedUpload(chunkedUrl, finalDestination, fileSize, config); await assembleChunkedUpload(chunkedUrl, finalDestination, fileSize, config);
const status = statusTools.getStatus();
status.status = States.IDLE;
status.progress = undefined;
statusTools.setStatus(status);
logger.info(`...Upload finish !`);
fs.unlinkSync(localPath);
} catch (err) { } catch (err) {
if (err instanceof RequestError) { if (err instanceof RequestError) {
messageManager.error( messageManager.error(
@ -482,7 +488,7 @@ export function initChunkedUpload(
finalDestination: string, finalDestination: string,
config: WebdavConfig config: WebdavConfig
) { ) {
logger.debug(`Init chuncked upload.`); logger.info(`Init chuncked upload.`);
logger.debug(`...URI: ${encodeURI(url)}`); logger.debug(`...URI: ${encodeURI(url)}`);
logger.debug(`...Final destination: ${encodeURI(finalDestination)}`); logger.debug(`...Final destination: ${encodeURI(finalDestination)}`);
return got(encodeURI(url), { return got(encodeURI(url), {
@ -504,7 +510,7 @@ export function assembleChunkedUpload(
config: WebdavConfig config: WebdavConfig
) { ) {
const chunckFile = `${url}/.file`; const chunckFile = `${url}/.file`;
logger.debug(`Assemble chuncked upload.`); logger.info(`Assemble chuncked upload.`);
logger.debug(`...URI: ${encodeURI(chunckFile)}`); logger.debug(`...URI: ${encodeURI(chunckFile)}`);
logger.debug(`...Final destination: ${encodeURI(finalDestination)}`); logger.debug(`...Final destination: ${encodeURI(finalDestination)}`);
return got(encodeURI(chunckFile), { return got(encodeURI(chunckFile), {