You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created a CustomFileSystem
When writing method throws an error, FileZilla tries to upload the file again in an Unlimited LOOP.
I used the error event for stream, but it doesn't help.
Can anybody help to solve the problem?
Thanks
async write(path: string,{ append =false, start =undefined}){returnnewPromise((resolve,reject)=>{constfileName=path;consthashName=uniqueStringId();const{ fsPath }=this.resolvePath(path);console.log('Write',{ fsPath, hashName });constwritable=newWritable();constchunks: Buffer[]=[];writable.on('error',(err)=>{letfilePath=fsPath+sep+hashName;unlink(filePath).catch((err)=>console.error('Error delete file in writing',err.message));returnreject(err);});writable._write=(chunk,encoding,done)=>{chunks.push(chunk);done();};/** * Stream write error simulation */setTimeout(()=>{writable.emit('error',newError('.......Stream write error simulation........'));},500);writable.on('finish',async()=>{letfilePath=fsPath+sep+hashName;try{awaitwriteFile(filePath,Buffer.concat(chunks));letmimeType=lookup(fileName);if(!mimeType){this.connection.reply(550,'File type is not correct!');}constfileStat=awaitstat(filePath);awaitthis.api.post('/ftp/upload',{name: fileName,mimeType: mimeType,size: fileStat.size,disk: this.disk,dirName: this.dirName});}catch(error){if(error.response?.status===401){this.connection.reply(550,'Token has been expired, please login again.');}console.error('Error writing file:',error.response?.data?.message||error.response?.statusText||error.message);this.connection.reply(550,'Something went wrong! Please inform us by sending an email to support @fikper.com!');returnreject(error);}});resolve(writable);});}
The text was updated successfully, but these errors were encountered:
I created a CustomFileSystem
When writing method throws an error, FileZilla tries to upload the file again in an Unlimited LOOP.
I used the error event for stream, but it doesn't help.
Can anybody help to solve the problem?
Thanks
The text was updated successfully, but these errors were encountered: