Guard FileView recursion against file nodes#1661
Conversation
jeremypw
left a comment
There was a problem hiding this comment.
This seems more complicated than necessary? I tried just checking that the item is a FolderItem in original line 224 and it seems to fix the problem. Is there a structure that fails with just this?
|
To prevent the crash, I suppose you are right. But to me, if I understand the code correctly, there might be situations where we overwalk the tree. Imagine this tree: Say It iterates over the children of Now, we wonder if the target path starts with this child's path. As Because of that prefix match, we expand The extra separator-aware check I proposed insists on With that in place, we skip I should admit that the code is a bit more complex, though. |
|
Ah, I see - good point. I wonder whether we could use |
|
Using seems to work. Unfortunately the |
963afd1 to
f2d8c2a
Compare
|
Good catch! I have updated the PR with that approach. Also, for optimisation, I have added the optional Don't hesitate if you see other possible improvements! |
jeremypw
left a comment
There was a problem hiding this comment.
Nice optimization! LGTM now.
|
Nothing in the diff that would affect flatpak and it builds as flatpak OK locally so merging. |
Fixes #1654.
Fixes #1662