View Issue Details

IDProjectCategoryView StatusLast Update
0001705FreeCADBugpublic2015-01-04 22:39
Reportershoogen Assigned Towmayer  
PrioritylowSeveritytweakReproducibilityhave not tried
Status closedResolutionfixed 
OSLinux 
Product Version0.15 
Summary0001705: Download manager does not follow redirect (HTTP status 302)
Descriptionwhen Downloading a file from Dropbox a FCStd file is created showing only the original http response.
302 Found
The resource was found at https://dl.dropboxusercontent.com/content_link/[redacted];
you should be redirected automatically.

Steps To Reproduceuse a dropbox download link with "?dl=1"
TagsNo tags attached.
FreeCAD Information

Activities

wmayer

2015-01-04 13:05

administrator   ~0005502

A concrete example is here:
http://forum.freecadweb.org/viewtopic.php?f=8&t=9050&p=73623&hilit=dropbox#p73623

The link is https://www.dropbox.com/s/isyfghl3icpffn4/Weihnachtsbaum.FCStd?dl=0
The download link is https://www.dropbox.com/s/isyfghl3icpffn4/Weihnachtsbaum.FCStd?dl=1

I wonder how this works in general. The solution cannot be that we explicitly check for dropbox is host name and then replace the "dl=0" with "dl=1".

When I click on this link from a browser then it will also first download the new HTML site which presents the actual download link, then.

Any ideas?

shoogen

2015-01-04 14:25

developer   ~0005504

Last edited: 2015-01-04 14:25

This is outside the scope of the ticket. The ticket is about not respecting the HTTP status codes.

But i think that there is no suitable alternative to rewriting the urls. Not only for dropbox but for all major file hosting services (including google drive)
Of cause we could open a html view, and let the user do a second click.
We could as well punish people who don't add plain download links to their forum posts.

wmayer

2015-01-04 14:46

administrator   ~0005505

So, as far as I understand your request now the user has to click the dropbox url in this post http://forum.freecadweb.org/viewtopic.php?f=8&t=9050&p=73623&hilit=dropbox#p73623 which then opens the dropbox site. This site offers a Download button with the url https://www.dropbox.com/s/isyfghl3icpffn4/Weihnachtsbaum.FCStd?dl=1

However, this still isn't the actual download link but https://dl.dropboxusercontent.com/content_link/PTu9FdaM5f7JNlYhJgzVGdgB7m3Bobs1BVrBQ6tRqbwZ1552DUJ8YXWG3TaqJ0pI?dl=1

shoogen

2015-01-04 14:56

developer   ~0005506

> However, this still isn't the actual download link
And as there is no obvious correlation to the "official" link, IMHO we have to handle the HTTP 302 (as well)
But this won't solve the problem you mentioned above. (?dl=1)

wmayer

2015-01-04 17:14

administrator   ~0005509

I have a solution:

DownloadManager gets the method redirectUrl which explicitly replaces the url to dropbox to be '?dl=1'

DownloadManager doesn't start the download immediately but handles the finished() signal of the network manager. In the connected slot it examines the url whether it's the original or a redirected one.

But it still doesn't work to fetch files uploaded to Mantis. A url there e.g. looks like this: http://www.freecadweb.org/tracker/file_download.php?file_id=418&type=bug and when downloading it there is a text that access was denied.

However, with a browser I can download files too without being logged in. Any ideas about this?

shoogen

2015-01-04 20:40

developer   ~0005515

when the type=bug is omitted i get the same result.

wmayer

2015-01-04 22:14

administrator   ~0005517

When opening a report with webkit:
import WebGui
WebGui.openBrowser("http://www.freecadweb.org/tracker/view.php?id=972")

then surprisingly the url (click or drag'n'drop) works while when dragging from a browser (tested with FF and Opera) it doesn't. I compared the string of the urls and found out that the failing urls ends with CR+LF.

So, removing the CR+LF does the trick.

Related Changesets

FreeCAD: master c3102b69

2015-01-04 18:15:20

wmayer

Details Diff
+ issue 0001705: Download manager does not follow redirect (HTTP status 302) Affected Issues
0001705
mod - src/Gui/DownloadItem.cpp Diff File
mod - src/Gui/DownloadManager.cpp Diff File
mod - src/Gui/DownloadManager.h Diff File
mod - src/Gui/MainWindow.cpp Diff File

FreeCAD: master b2e32abe

2015-01-04 23:15:58

wmayer

Details Diff
+ fixes 0001705: Download manager does not follow redirect (HTTP status 302) Affected Issues
0001705
mod - src/Gui/DownloadManager.cpp Diff File

Issue History

Date Modified Username Field Change
2014-08-22 13:04 shoogen New Issue
2014-08-22 13:05 shoogen Summary Download manager does follow HTTP status 302 => Download manager does not follow redirect (HTTP status 302)
2015-01-04 13:05 wmayer Note Added: 0005502
2015-01-04 14:25 shoogen Note Added: 0005504
2015-01-04 14:25 shoogen Note Edited: 0005504
2015-01-04 14:46 wmayer Note Added: 0005505
2015-01-04 14:56 shoogen Note Added: 0005506
2015-01-04 17:14 wmayer Note Added: 0005509
2015-01-04 17:30 wmayer Changeset attached => FreeCAD Master master c3102b69
2015-01-04 20:40 shoogen Note Added: 0005515
2015-01-04 22:14 wmayer Note Added: 0005517
2015-01-04 22:39 wmayer Changeset attached => FreeCAD Master master b2e32abe
2015-01-04 22:39 wmayer Assigned To => wmayer
2015-01-04 22:39 wmayer Status new => closed
2015-01-04 22:39 wmayer Resolution open => fixed