From 6c4f566765b7d6186917ac3b8d2cd619580136a2 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 11 May 2023 19:12:39 +0100 Subject: [PATCH] Doc: Fix download links --- Assets/WebsiteAssets/js/script.js | 4 +++- README.md | 2 +- packages/tools/update-readme-download.ts | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Assets/WebsiteAssets/js/script.js b/Assets/WebsiteAssets/js/script.js index 973a57aa6..b386719a5 100644 --- a/Assets/WebsiteAssets/js/script.js +++ b/Assets/WebsiteAssets/js/script.js @@ -9,7 +9,9 @@ function getOs() { function getFilename(path) { if (!path) return ''; const s = path.split('/'); - return s.pop(); + const urlWithParams = s.pop(); + const s2 = urlWithParams.split('?'); + return s2[0]; } function getMobileOs() { diff --git a/README.md b/README.md index f0e4d858f..b9f21ef38 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Linux | Get it on Google Play | or download the APK file: [64-bit](https://github.com/laurent22/joplin-android/releases/download/android-v2.9.8/joplin-v2.9.8.apk?source=JoplinWebsite&type=New) [32-bit](https://github.com/laurent22/joplin-android/releases/download/android-v2.9.8/joplin-v2.9.8-32bit.apk?source=JoplinWebsite&type=New) +Android | Get it on Google Play | or download the APK file: [64-bit](https://objects.joplinusercontent.com/android-v2.9.8/joplin-v2.9.8.apk?source=JoplinWebsite&type=New) [32-bit](https://objects.joplinusercontent.com/android-v2.9.8/joplin-v2.9.8-32bit.apk?source=JoplinWebsite&type=New) iOS | Get it on the App Store | - ## Terminal application diff --git a/packages/tools/update-readme-download.ts b/packages/tools/update-readme-download.ts index e275860e2..0967abce2 100644 --- a/packages/tools/update-readme-download.ts +++ b/packages/tools/update-readme-download.ts @@ -19,6 +19,7 @@ function downloadUrl(release: GitHubRelease, os: string, portable = false) { const name = asset.name; const ext = fileExtension(name); + const githubAndroidUrl = 'github.com/laurent22/joplin-android/releases/download'; const githubUrl = 'github.com/laurent22/joplin/releases/download'; const joplinDomain = 'objects.joplinusercontent.com'; @@ -34,9 +35,9 @@ function downloadUrl(release: GitHubRelease, os: string, portable = false) { if (ext === 'AppImage' && os === 'linux') return asset.browser_download_url.replace(githubUrl, joplinDomain); - if (os === 'android32' && name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubUrl, joplinDomain); + if (os === 'android32' && name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubAndroidUrl, joplinDomain); - if (os === 'android' && ext === 'apk' && !name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubUrl, joplinDomain); + if (os === 'android' && ext === 'apk' && !name.endsWith('32bit.apk')) return asset.browser_download_url.replace(githubAndroidUrl, joplinDomain); } throw new Error(`Could not find download URL for: ${os}`);