mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 22:40:29 +03:00
net: improve parsing filenames from URL
This is more relevant to issuebot than fdroidserver, but it can't hurt here also.
This commit is contained in:
parent
f8789f2997
commit
107593d3ba
2 changed files with 72 additions and 1 deletions
|
|
@ -18,12 +18,13 @@
|
|||
|
||||
import os
|
||||
import requests
|
||||
import urllib
|
||||
|
||||
HEADERS = {'User-Agent': 'F-Droid'}
|
||||
|
||||
|
||||
def download_file(url, local_filename=None, dldir='tmp'):
|
||||
filename = url.split('/')[-1]
|
||||
filename = urllib.parse.urlparse(url).path.split('/')[-1]
|
||||
if local_filename is None:
|
||||
local_filename = os.path.join(dldir, filename)
|
||||
# the stream=True parameter keeps memory usage low
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue