Make it possible again to open an archive as folder with "dolphin archive.tar.gz"

Review Request #119877 - Created Aug. 20, 2014 and submitted

Information
Frank Reininghaus
kde-baseapps
KDE/4.14
333078
Reviewers
dolphin

This used to work some time ago (at least if "Open archives as folder" was enabled in the settings). I found out some time ago with git bisect that this was broken by https://git.reviewboard.kde.org/r/110487/ , but it was a mystery to me why that (apparently not really related) patch could be a problem.

I just spent some time debugging it, and it turned out that the crucial difference caused by the patch is that checking if the file is an archive is only done if the mime type is known already. This wasn't the case before that commit.

The reason why this change in DolphinViewContainer::slotItemActivated(const KFileItem& item) (and code called from there) matters at all in situations where we tell Dolphin to open a file from the command line, and nothing has actually been activated at all inside Dolphin, is the following: the function that gets called when the dir lister reports the error that it has been told to open a file (with an unsuitable protocol) calls slotItemActivated, which then tries to correct the mistake and open the file properly.

I think the best way to fix this is to handle the "file is archive" case directly in slotUrlIsFileError, and determine the mime type there. We should keep the "isMimeTypeKnown"-check in DolphinView::openItemAsFolderUrl(KFileItem, bool) to prevent GUI blocking if lots of files with unknown type are opened at the same time.

The additional benefit of this solution is that "dolphin archive.tar.gz" works even if "Open archives as folder" is disabled. So users who usually want to use Ark to handle files can use this method to open an archive inside Dolphin. (I think it's unlikely that anyone actually expects Dolphin to open Ark when entering "dolphin archive.tar.gz" on the command line.)

Fixes the problem for me. No new problems found so far.

Emmanuel Pescosta
Frank Reininghaus
Review request changed

Status: Closed (submitted)

Arjun AK

One problem with this patch is that when you open "archive.tar" it adds "file://archive.tar" to the history, which in turn causes the back button to be enabled, with the back button pointing to "file://archive.tar".

  1. Thanks Arjun, really good catch!

    Can you please open a new bug report and describe the problem there? Thanks in advance!

Loading...