Skip to content

fix: missing lowercase comparison in electron-updater #8992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wicked-zebras-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

Fixed missing lowercase in extension comparison.
2 changes: 1 addition & 1 deletion packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ export abstract class AppUpdater extends (EventEmitter as new () => TypedEmitter
function getCacheUpdateFileName(): string {
// NodeJS URL doesn't decode automatically
const urlPath = decodeURIComponent(taskOptions.fileInfo.url.pathname)
if (urlPath.endsWith(`.${taskOptions.fileExtension}`)) {
if (urlPath.toLowerCase().endsWith(`.${taskOptions.fileExtension.toLowerCase()}`)) {
return path.basename(urlPath)
} else {
// url like /latest, generate name
Expand Down
4 changes: 2 additions & 2 deletions packages/electron-updater/src/providers/Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ export function findFile(files: Array<ResolvedUpdateFileInfo>, extension: string
throw newError("No files provided", "ERR_UPDATER_NO_FILES_PROVIDED")
}

const result = files.find(it => it.url.pathname.toLowerCase().endsWith(`.${extension}`))
const result = files.find(it => it.url.pathname.toLowerCase().endsWith(`.${extension.toLowerCase()}`))
if (result != null) {
return result
} else if (not == null) {
return files[0]
} else {
return files.find(fileInfo => !not.some(ext => fileInfo.url.pathname.toLowerCase().endsWith(`.${ext}`)))
return files.find(fileInfo => !not.some(ext => fileInfo.url.pathname.toLowerCase().endsWith(`.${ext.toLowerCase()}`)))
}
}

Expand Down