Skip to content
  • Stefano Crocco's avatar
    Improve behavior when kfmclient openURL is launched with invalid URL · feb9e94d
    Stefano Crocco authored
    If kfmclient openURL is launched with an invalid URL, filteredURL will
    return an empty URL which causes Konqueror to display an "Undocumented
    error" error message.
    
    To avoid this, when filteredUrl returns an empty URL, use the user's
    home URL, as if no URL had been specified. In this case we also ignore
    the mimetype requested by the user (if any) because in most cases it
    won't be correct for the new URL.
    
    This situation can be triggered if the user clicks on the
    `kfmclient_html.desktop` file. In theory, this shouldn't happen; however,
    currently it's happening quite often, as can be seen, for example,
    from [this bug report](https://bugs.kde.org/show_bug.cgi?id=453822)).
    As far as I could discover, this bug happens because the application launcher
    puts `kfmclient_html.desktop` in the "Favorites" section instead of `konqbrowser.desktop`.
    Clicking on it executes `kfmclient openURL %u text/html`, passing a literal `%u` as argument.
    Since `%u` isn't a valid URL, the behavior described above occurs.
    
    While the correct fix for the bug itself is to find out why the application launcher uses `kfmclient_html.desktop`,
    I think that `kfmclient` should nonetheless have a more user-friendly behavior in case an invalid URL is given.
    
    
    (cherry picked from commit 1d8a39a1)
    feb9e94d