Workaround for uGet integration wrong file name

uGet’s browser integration module does not seem to support content-disposition fields. This often results in downloaded files having inconvenient names like download.php or some GUID like e94d8f80-7e18-11e9-80e1-46db6c91c5c0. This problem did not exist in older versions of uGet since it used to auto-rename files ignoring file names set by users or by plugins. This behavior has now changed.

Solution

uGet uses either aria2 or cURL as a backend to download files. Both programs support getting the filename from the content-disposition header. uGet seems to invoke aria2 and cURL with this option enabled, provided that the user does not set a file name in advance. So if we block the uGet integration module from setting the filename, we can make use of the backend functionality. This can be achieved by a small edit to the uget-integrator.py file.

Find uget-integrator.py file

The first step is to find uget-integrator.py file. In Windows, it should be in C:\Program Files (x86)\uget-integrator, unless you used the portable option.

Edit uget-integrator.py

In uget-integrator.py find the line.

fileName = basename(urlparse(url).path).replace('%20', ' ')

Comment out the line and add a new line as shown below

#fileName = basename(urlparse(url).path).replace('%20', ' ')
fileName = ""

How the code should look after editing

uGet integration code after change

What happens next?

The filename in the new download window will show up as blank.  Leave it blank to use the default file name from the backend downloader. At the start of the download, the file name shown in the download list might be some gibberish. But a more meaningful file name should appear soon.

1 thought on “Workaround for uGet integration wrong file name”

Leave a Comment

Your email address will not be published. Required fields are marked *