Skip to content

Commit 1f50540

Browse files
authored
fix: missing lowercase comparison in electron-updater (#8992)
1 parent cf43f05 commit 1f50540

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.changeset/wicked-zebras-begin.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"electron-updater": patch
3+
---
4+
5+
Fixed missing lowercase in extension comparison.

packages/electron-updater/src/AppUpdater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
715715
function getCacheUpdateFileName(): string {
716716
// NodeJS URL doesn't decode automatically
717717
const urlPath = decodeURIComponent(taskOptions.fileInfo.url.pathname)
718-
if (urlPath.endsWith(`.${taskOptions.fileExtension}`)) {
718+
if (urlPath.toLowerCase().endsWith(`.${taskOptions.fileExtension.toLowerCase()}`)) {
719719
return path.basename(urlPath)
720720
} else {
721721
// url like /latest, generate name

packages/electron-updater/src/providers/Provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ export function findFile(files: Array<ResolvedUpdateFileInfo>, extension: string
8585
throw newError("No files provided", "ERR_UPDATER_NO_FILES_PROVIDED")
8686
}
8787

88-
const result = files.find(it => it.url.pathname.toLowerCase().endsWith(`.${extension}`))
88+
const result = files.find(it => it.url.pathname.toLowerCase().endsWith(`.${extension.toLowerCase()}`))
8989
if (result != null) {
9090
return result
9191
} else if (not == null) {
9292
return files[0]
9393
} else {
94-
return files.find(fileInfo => !not.some(ext => fileInfo.url.pathname.toLowerCase().endsWith(`.${ext}`)))
94+
return files.find(fileInfo => !not.some(ext => fileInfo.url.pathname.toLowerCase().endsWith(`.${ext.toLowerCase()}`)))
9595
}
9696
}
9797

0 commit comments

Comments
 (0)