Skip to content
Merged
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
12 changes: 7 additions & 5 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2633,11 +2633,13 @@
StaplerRequest2 currentRequest = Stapler.getCurrentRequest2();
currentRequest.getWebApp().getDispatchValidator().allowDispatch(currentRequest, Stapler.getCurrentResponse2());
String userAgent = currentRequest.getHeader("User-Agent");

List<String> platformsThatUseCommand = List.of("MAC", "IPHONE", "IPAD");
boolean useCmdKey = platformsThatUseCommand.stream().anyMatch(e -> userAgent.toUpperCase().contains(e));

return keyboardShortcut.replace("CMD", useCmdKey ? "⌘" : "CTRL");
if (userAgent != null) {

Check warning on line 2636 in core/src/main/java/hudson/Functions.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 2636 is only partially covered, one branch is missing
List<String> platformsThatUseCommand = List.of("MAC", "IPHONE", "IPAD");
boolean useCmdKey = platformsThatUseCommand.stream().anyMatch(e -> userAgent.toUpperCase().contains(e));
return keyboardShortcut.replace("CMD", useCmdKey ? "⌘" : "CTRL");
} else {
return keyboardShortcut;

Check warning on line 2641 in core/src/main/java/hudson/Functions.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 2641 is not covered by tests
}
}

@Restricted(NoExternalUse.class)
Expand Down
Loading