From: Hans-Christoph Steiner Date: Thu, 1 Jun 2017 08:29:30 +0000 (+0200) Subject: strip file extension from generated name for non-APKs X-Git-Tag: 0.8~49^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=372c8b418db7e3c661debbd24df2f405baa95569;p=fdroidserver.git 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. --- diff --git a/fdroidserver/index.py b/fdroidserver/index.py index 32727115..942c5861 100644 --- a/fdroidserver/index.py +++ b/fdroidserver/index.py @@ -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) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index c36fd86e..614ae07f 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -843,8 +843,8 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False): if not usecache: logging.debug("Processing " + name_utf8) repo_file = collections.OrderedDict() + repo_file['name'] = os.path.splitext(name_utf8)[0] # TODO rename apkname globally to something more generic - repo_file['name'] = name_utf8 repo_file['apkName'] = name_utf8 repo_file['hash'] = shasum repo_file['hashType'] = 'sha256' diff --git a/tests/repo/index.xml b/tests/repo/index.xml index ff958b7b..4b85a960 100644 --- a/tests/repo/index.xml +++ b/tests/repo/index.xml @@ -12,7 +12,7 @@ fake.ota.update 2016-03-10 2016-03-10 - fake.ota.update_1234.zip + fake.ota.update_1234 Tests whether OTA ZIP files are being include <p>F-Droid can make use of system privileges or permissions to install, update and remove applications on its own. The only way to obtain those privileges is to become a system app.</p><p>This is where the Privileged Extension comes in - being a separate app and much smaller, it can be installed as a system app and communicate with the main app via AIDL IPC.</p><p>This has several advantages:</p><ul><li> Reduced disk usage in the system partition</li><li> System updates don't remove F-Droid</li><li> The process of installing into system via root is safer</li></ul><p>This is packaged as an OTA (Over-The-Air) update ZIP file. It must be installed using TWRP or other Android recovery that can flash updates to the system from the /data/data/org.fdroid.fdroid folder on the /data partition. The standalone APK is called F-Droid Privileged Extension.</p> Apache-2.0