Page MenuHomePhorge

D25868.1740120751.diff
No OneTemporary

D25868.1740120751.diff

diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -626,20 +626,25 @@
// Try to guess the device resolution based on UA strings to avoid a flash
// of incorrectly-styled content.
$device_guess = 'device-desktop';
- if (preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@', $agent)) {
- $device_guess = 'device-phone device';
- } else if (preg_match('@iPad|(Android.*Chrome/)@', $agent)) {
- $device_guess = 'device-tablet device';
+ if (phutil_nonempty_string($agent)) {
+ if (preg_match('@iPhone|iPod|(Android.*Chrome/[.0-9]* Mobile)@',
+ $agent)) {
+ $device_guess = 'device-phone device';
+ } else if (preg_match('@iPad|(Android.*Chrome/)@', $agent)) {
+ $device_guess = 'device-tablet device';
+ }
}
$classes[] = $device_guess;
- if (preg_match('@Windows@', $agent)) {
- $classes[] = 'platform-windows';
- } else if (preg_match('@Macintosh@', $agent)) {
- $classes[] = 'platform-mac';
- } else if (preg_match('@X11@', $agent)) {
- $classes[] = 'platform-linux';
+ if (phutil_nonempty_string($agent)) {
+ if (preg_match('@Windows@', $agent)) {
+ $classes[] = 'platform-windows';
+ } else if (preg_match('@Macintosh@', $agent)) {
+ $classes[] = 'platform-mac';
+ } else if (preg_match('@X11@', $agent)) {
+ $classes[] = 'platform-linux';
+ }
}
if ($this->getRequest()->getStr('__print__')) {

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 21, 06:52 (22 h, 22 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1165138
Default Alt Text
D25868.1740120751.diff (1 KB)

Event Timeline