[KUrlNavigator] Fix URL navigation when exiting archive with krarc and Dolphin
ClosedPublic

Authored by nhiga on Apr 10 2019, 4:59 AM.

Details

Summary

If Krusader is installed, the krarc protocol is available and Dolphin may use it to open ZIP archives. In this case, when the user goes back to a parent folder outside the archive, a "file or folder does not exist" error will be returned. This can be fixed by including krarc in the URL scheme check inside the KUrlNavigator::setLocationUrl method.

BUG: 386448
FIXED-IN: 5.58

Test Plan
  1. Install Krusader and Dolphin.
  2. Enable "Open archives as folder" in Dolphin and open a zip file using the krarc protocol. (Change zip: to karc: when applicable.)
  3. Click on the breadcrumb in the location area for a parent folder which is outside the archive.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nhiga requested review of this revision.Apr 10 2019, 4:59 AM
nhiga created this revision.
ngraham accepted this revision.Apr 10 2019, 4:58 PM
ngraham added a subscriber: ngraham.

Thanks very much, this is perfect. Lovely, easy-to-follow Test Plan, too.

Can you please provide your full name and email address so we can land your patch with correct authorship information?

This revision is now accepted and ready to land.Apr 10 2019, 4:58 PM
ngraham edited the summary of this revision. (Show Details)Apr 10 2019, 4:58 PM
nhiga added a comment.Apr 11 2019, 3:37 AM

I've just updated my KDE Identity account - my full name and email address can now be found by searching the username "nhiga" on KDE Identity - People. I'm sorry for the inconvenience caused.

Unfortunately the search on that page is largely non-functional and I can't find you there. Can you put the info in a comment here?

aacid added a subscriber: aacid.Apr 11 2019, 3:28 PM

Unfortunately the search on that page is largely non-functional and I can't find you there. Can you put the info in a comment here?

For the record, search is functional, it's just that not many people have enough permissions to actually search, since it could be a privacy problem. Probably it would need some warning in case whoever is trying to make a search doesn't have permission to do it.

aacid added a comment.Apr 11 2019, 3:33 PM

This patch also seems to show there's an architectural shortcoming here.

KIO should not know about some protocol that is krusader specific.

I don't want to block on this, but it'd be good to open a bug so maybe someone at some point finds a better solution.

Or even better, if you have some time maybe you can try to figure out how we would do that.

Unfortunately the search on that page is largely non-functional and I can't find you there. Can you put the info in a comment here?

For the record, search is functional, it's just that not many people have enough permissions to actually search, since it could be a privacy problem. Probably it would need some warning in case whoever is trying to make a search doesn't have permission to do it.

I can find plenty of people when I search... just never the ones I'm looking for. :(

This patch also seems to show there's an architectural shortcoming here.

KIO should not know about some protocol that is krusader specific.

I don't want to block on this, but it'd be good to open a bug so maybe someone at some point finds a better solution.

Or even better, if you have some time maybe you can try to figure out how we would do that.

Agreed, maybe these IOSlaves should set some hint that KIO can then read? Or maybe KIO can figure it out for itself for IOSlaves that implement archive browsing.

@ngraham The people you will be finding will be those who hold developer accounts - because their information is available in kde-common/accounts, that information is also made accessible on Identity.
The people you're trying to find will likely be non-developers though, hence why you're not finding them.

@ngraham The people you will be finding will be those who hold developer accounts - because their information is available in kde-common/accounts, that information is also made accessible on Identity.
The people you're trying to find will likely be non-developers though, hence why you're not finding them.

Aha, that makes sense! Unfortunately, it's entirely useless for my purposes. :(

nhiga added a comment.Apr 12 2019, 2:33 AM

With krarc, users can open 7z and RAR files as folder in Dolphin (with patches [1] [2]). This is also useful for Gwenview - if you have pictures in a 7z or RAR archive, then you can view them in Gwenview without decompressing the whole archive to another location. However, I'm not sure whether it's appropriate to add these Krusader-specific things to KIO.

[1] For Krusader, add application/vnd.rar to archiveMimetype in krArc/krarc.protocol
[2] For KIO, add mime.inherits(QStringLiteral("application/vnd.rar")) and mime.inherits(QStringLiteral("application/x-7z-compressed")) to KUrlNavigator::Private::isCompressedPath in src/filewidgets/kurlnavigator.cpp

Since the hardcoded list of affected protocols is already there, let's add the new one for now. In the future we'll look into moving this information into a more appropriate place.

This revision was automatically updated to reflect the committed changes.