Fixing bug where MTP slave does not return error in stat()/mimetype()
ClosedPublic

Authored by feverfew on Aug 25 2019, 7:47 PM.

Details

Summary

This patch fixes two cases where invalid KTMPFile objects would be treated as
valid. In particular, this would manifest in KIO::stat() and KIO::mimetype()
returning without error when they, in fact, should do. One would note that in
the rest of the code, KMTPFile objects that are received via
KMTPStorageInterface::getFileMetaData() always have a isValid() check applied
before use. The two previously mentioned functions, incorrectly, do not have
this check applied. This patch simply adds these necessary checks.

Test Plan

KIOFuse uses KIO::stat() to complete a lookup. Before this patch lookup would
always succeed and this was determined to be because stat would always succeed.
This bug could be easily found as tab completion would never work correctly.
Trying to tab complete would seem to add what was already typed in to the
directory. With this patch applied, lookup no longer always succeeds and tab
completion now works.

Diff Detail

Repository
R320 KIO Extras
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
feverfew created this revision.Aug 25 2019, 7:47 PM
Restricted Application added projects: Dolphin, Frameworks. · View Herald TranscriptAug 25 2019, 7:47 PM
Restricted Application added subscribers: kfm-devel, kde-frameworks-devel. · View Herald Transcript
feverfew requested review of this revision.Aug 25 2019, 7:47 PM
dfaure accepted this revision.Aug 26 2019, 7:09 AM
This revision is now accepted and ready to land.Aug 26 2019, 7:09 AM
This revision was automatically updated to reflect the committed changes.