mirror of https://github.com/jenkinsci/jenkins.git
Do not modify keyboard shortcut when User-Agent header is not set (#10413)
* fix: Do not modify keyboard shortcut when User-Agent header is not set * Add whitespace after if to pass code style check
This commit is contained in:
parent
a9efc2c277
commit
73185b257d
|
@ -2633,11 +2633,13 @@ public class Functions {
|
|||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@Restricted(NoExternalUse.class)
|
||||
|
|
Loading…
Reference in New Issue