strip file extension from generated name for non-APKs

With a generic file, the file name is the only guaranteed name metadata
field.  So if the name is not specified in the metadata, then the name
is set to the filename.  This changes that so that the file extension is
stripped from that generated name.
This commit is contained in:
Hans-Christoph Steiner 2017-06-01 10:29:30 +02:00
parent 6105f8a184
commit 372c8b418d
3 changed files with 3 additions and 3 deletions

View file

@ -448,7 +448,7 @@ def make_v0(apps, apks, repodir, repodict, requestsdict):
and repodir == 'repo': # only create these
namefield = common.config['current_version_name_source']
sanitized_name = re.sub(b'''[ '"&%?+=/]''', b'', app.get(namefield).encode('utf-8'))
apklinkname = sanitized_name + b'.apk'
apklinkname = sanitized_name + os.path.splitext(current_version_file)[1].encode('utf-8')
current_version_path = os.path.join(repodir, current_version_file).encode('utf-8', 'surrogateescape')
if os.path.islink(apklinkname):
os.remove(apklinkname)