Bug 180136

Summary: better handling of filenames if download name changes due to redirections
Product: [Applications] kget Reporter: Volkmar Wörner <volkmar.woerner+KDE>
Component: generalAssignee: KGet authors <kget>
Status: RESOLVED FIXED    
Severity: normal CC: jorti, mat69, metrobotte, reuben_p, squan, s_chriscollins
Priority: NOR    
Version: 2.3.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Fixes the redirection

Description Volkmar Wörner 2009-01-09 14:53:28 UTC
Version:           2.2.60 (using Devel)
OS:                Linux
Installed from:    Compiled sources

If I enter a download URL in kget directly, kget offers the website filename as destination filename. If the URL contains a redirection, the destination filename won't anymore be the original filename.
In the firefox extension DownThemAll! the destination filename will be renamed if possible. This should be the default behaviour for kget too.


For example I have the URL http://vloeck.de/ul/vogel.php and want to save the download with kget, I get as destination "/some/folder/vogel.php". The above mentioned PHP-File is a redirection to http://vloeck.de/ul/vogel.jpg, which gets saved to "/some/folder/vogel.php" though it is a jpeg image file
Comment 1 Urs Wolfer 2009-01-24 17:34:19 UTC
*** Bug 181771 has been marked as a duplicate of this bug. ***
Comment 2 squan 2009-06-06 23:06:39 UTC
URL handling when downloading like described in Bug 181771 is still broken in kget 4.2.88 (KDE 4.3-beta2) although the behaviour changed a little bit:
If a download is initiated I now get a Popup stating "Ungültige Adresse, das Protokoll fehlt" (Invalid address, missing protocol).
Comment 3 Lukas Appelhans 2010-01-02 01:20:00 UTC
*** Bug 209333 has been marked as a duplicate of this bug. ***
Comment 4 Matthias Fuchs 2011-08-09 11:14:54 UTC
I think what we might do is automatically rename files on redirections if the follow these conditions:
a) only one url for the transfer
b) not written to the file yet or resumeable
c) not named onself initially
Comment 5 Myriam Schweingruber 2012-06-21 19:56:36 UTC
This report was last reported for version 2.3.2. Is this still valid for version 2.8.0 or later?
Comment 6 Volkmar Wörner 2012-06-21 20:05:11 UTC
the behaviour has not changed since 2.3.2, it still happens with 2.8.0 (at least on Windows)
Comment 7 Lukas Appelhans 2012-07-08 12:13:41 UTC
Created attachment 72366 [details]
Fixes the redirection

Please test this patch if you have the chance, it should fix it :) I'm not sure if this should go to 4.9 or later 4.10...
Comment 8 S. Christian Collins 2012-07-28 12:17:03 UTC
I can confirm that this patch does indeed work :)
Comment 9 S. Christian Collins 2012-07-28 12:18:03 UTC
Whoops, forgot to specify: I tested the patch using KDE 4.8.4 sources in Kubuntu 12.04 64-bit.
Comment 10 Lukas Appelhans 2012-08-21 08:53:42 UTC
*** Bug 295717 has been marked as a duplicate of this bug. ***
Comment 11 Lukas Appelhans 2012-08-21 10:29:53 UTC
SVN commit 1312138 by lappelhans:

Handle url redirections correctly.


 M  +8 -0      core/datasourcefactory.cpp  
 M  +2 -0      core/datasourcefactory.h  
 M  +5 -0      core/transferdatasource.h  
 M  +9 -0      transfer-plugins/multisegmentkio/multisegkiodatasource.cpp  
 M  +2 -0      transfer-plugins/multisegmentkio/multisegkiodatasource.h  
 M  +7 -0      transfer-plugins/multisegmentkio/segment.cpp  
 M  +3 -0      transfer-plugins/multisegmentkio/segment.h  
 M  +22 -0     transfer-plugins/multisegmentkio/transfermultisegkio.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1312138