Force downloads to have a filename

This commit is contained in:
Mathieu Comandon 2017-06-10 18:05:36 -07:00
parent edce767c4c
commit 72ddfa5cb6

View file

@ -254,13 +254,14 @@ class ScriptInterpreter(CommandsMixin):
else:
file_uri = game_file[file_id]
filename = os.path.basename(file_uri)
if not filename:
raise ScriptingError("No filename provided, please provide 'url' and 'filename' parameters in the script")
if file_uri.startswith("/"):
file_uri = "file://" + file_uri
elif file_uri.startswith(("$WINESTEAM", "$STEAM")):
# Download Steam data
self._download_steam_data(file_uri, file_id)
return
logger.debug("Fetching [%s]: %s" % (file_id, file_uri))
# Check for file availability in PGA
pga_uri = pga.check_for_file(self.game_slug, file_id)
@ -270,6 +271,8 @@ class ScriptInterpreter(CommandsMixin):
# Setup destination path
dest_file = os.path.join(self.cache_path, filename)
logger.debug("Downloading [%s]: %s to %s", file_id, file_uri, dest_file)
if file_uri.startswith("N/A"):
# Ask the user where the file is located
parts = file_uri.split(":", 1)