-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Low
-
None
-
Affects Version/s: 7.0.0
-
Component/s: Mobile
-
7
If you try to open jira on a windows mobile phone you will not be redirected to the mobile view like on an android phone.
The reason for this issue is a wrong regex string in the following class:
package com.atlassian.jira.mobile.utils;
import com.atlassian.gzipfilter.org.tuckey.web.filters.urlrewrite.utils.StringUtils;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
public final class MobileUtils
{
public static final String DESKTOP_URL_PARAMETER = "desktop";
private static final List<String> EXCLUDED_PREFIXES = Arrays.asList(new String[]
);
private static final Pattern MOBILE_USER_AGENT_REGEX = Pattern.compile("(iPhone;|iPhone Simulator;|iPod;|Linux;(?: U
? Android)");
private static final Pattern ANDROID_CHROME = Pattern.compile("Chrome/[.\\d]* Mobile");
private static final Pattern OLD_ANDROID = Pattern.compile("Linux;(?: U
? Android (?:[23]\\.\\d|4\\.0
.[12])");
public static boolean isMobileViewRequest(HttpServletRequest request)
{ return (isSupportedUserAgent(request)) && (!isDesktopSwitchRequired(request)) && (!isExcludedFromMobileTransformation(request)); } public static boolean isExcludedFromMobileTransformation(HttpServletRequest request)
{
for (String prefix : EXCLUDED_PREFIXES) {
if (request.getRequestURI().startsWith(request.getContextPath() + prefix))
}
return false;
}
public static boolean isSupportedUserAgent(HttpServletRequest request)
{
String userAgent = request.getHeader("user-agent");
if (StringUtils.isBlank(userAgent))
return (ANDROID_CHROME.matcher(userAgent).find()) || ((MOBILE_USER_AGENT_REGEX.matcher(userAgent).find()) && (!OLD_ANDROID.matcher(userAgent).find()));
}
public static boolean isDesktopSwitchRequired(HttpServletRequest request)
{
if (request.getCookies() != null) {
for (Cookie cookie : request.getCookies()) {
if (("jira.mobile.desktop.switch".equals(cookie.getName())) && ("true".equals(cookie.getValue())))
}
}
return Boolean.valueOf(request.getParameter("desktop")).booleanValue();
}
}
If you change "iPhone;" to "iPhone" the redirect will work also for windows phone. The user agent of an Lumia 930 e.g. is:
"Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"
- relates to
-
JRASERVER-45749 JIRA does not display the mobile site on Windows Phone
-
- Closed
-