Skip to content

Commit a1fe034

Browse files
committed
Fix detection for Brave browser
1 parent 66b2989 commit a1fe034

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/qz/installer/apps/locator/AppAlias.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ public String getName() {
8585
* "Mozilla Firefox" --> "Firefox"
8686
* "Microsoft Edge" --> "Edge"
8787
* "Google Chrome" --> "Chrome"
88-
* "Brave Browser" --> "Brave Browser"
88+
* "Brave Browser" --> "Brave"
8989
*/
9090
public String getName(boolean stripVendor) {
91+
// Strip "Browser" from "Brave Browser"
92+
if(stripVendor && name.endsWith("Browser")) {
93+
return name.substring(0, name.length() - 7).trim();
94+
}
9195
if(stripVendor && name.startsWith(vendor) && !name.equals(vendor)) {
92-
String stripped = name.substring(vendor.length()).trim();
93-
// Don't strip "Brave" from "Brave Browser", don't return an empty string
94-
if(!stripped.isEmpty() && !stripped.equalsIgnoreCase("browser")) {
95-
return stripped;
96-
}
96+
return name.substring(vendor.length()).trim();
9797
}
9898
return name;
9999
}

test/qz/installer/apps/AppLocatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void findRunningAppsTests(AppAlias app) {
9393
AppInfo appInfo = runningApp.getValue();
9494
log.info("[{}] found running as pid {} at '{}'", app, pid, appInfo.getExePath());
9595
}
96-
Assert.assertFalse(runningApps.isEmpty(), String.format("Unable to find a running [%s] process", app.name()));
96+
Assert.assertFalse(runningApps.isEmpty(), String.format("Unable to find a running [%s] process. Running app count must NOT be empty.", app.name()));
9797
}
9898

9999
/**

0 commit comments

Comments
 (0)