The CC is not 100% and we should figure out what to do about it. This issue is strictly about CC but more details about some general problems in the package can be found in #5875.
A follow-up of https://github.com/ckeditor/ckeditor5/issues/5848.
OK, I spent a bit of time on this code and I'm 99% sure that this state is impossible to be reached. Whenever the file reader is aborted, the promise is rejected so we end up in catch() and not in then().Â
In the past, you could do abort() while loading a file and that didn't correctly reject the file promise. I think that we fixed this with @jodator some time ago and that's why then() is no longer reached with the aborted status.
I'll remove this condition.
This appeared on CI after we merged https://github.com/ckeditor/ckeditor5-upload/pull/106 😂. So it seems that I was wrong.

It's this test:
it.only( 'should abort upload if image is removed', () => {
const file = createNativeFileMock();
setModelData( model, '<paragraph>{}foo bar</paragraph>' );
editor.execute( 'imageUpload', { file } );
const abortSpy = sinon.spy( loader, 'abort' );
expect( loader.status ).to.equal( 'reading' );
return loader.file.then( () => {
nativeReaderMock.mockSuccess( base64Sample );
const image = doc.getRoot().getChild( 0 );
model.change( writer => {
writer.remove( image );
} );
expect( loader.status ).to.equal( 'aborted' );
sinon.assert.calledOnce( abortSpy );
} );
} );
This is odd because CI passed for the PR...
And I ran it locally and it is clean
SUMMARY:
✔ 102 tests completed
=============================== Coverage summary ===============================
Statements : 100% ( 215/215 )
Branches : 100% ( 64/64 )
Functions : 100% ( 79/79 )
Lines : 100% ( 208/208 )
Most helpful comment
OK, I spent a bit of time on this code and I'm 99% sure that this state is impossible to be reached. Whenever the file reader is aborted, the promise is rejected so we end up in
catch()and not inthen().ÂIn the past, you could do
abort()while loading a file and that didn't correctly reject the file promise. I think that we fixed this with @jodator some time ago and that's whythen()is no longer reached with theabortedstatus.I'll remove this condition.