Merge pull request #4132 from nextcloud/fix-safari-gzip
Fix gzip files for Safari
This commit is contained in:
commit
1ee7e1c0b1
|
@ -95,7 +95,7 @@ class CssController extends Controller {
|
||||||
if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
|
if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
|
||||||
try {
|
try {
|
||||||
$gzip = true;
|
$gzip = true;
|
||||||
return $folder->getFile($fileName . '.gz');
|
return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class JsController extends Controller {
|
||||||
if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
|
if ($encoding !== null && strpos($encoding, 'gzip') !== false) {
|
||||||
try {
|
try {
|
||||||
$gzip = true;
|
$gzip = true;
|
||||||
return $folder->getFile($fileName . '.gz');
|
return $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,9 +155,9 @@ class JSCombiner {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$gzipFile = $folder->getFile($fileName . '.gz');
|
$gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
$gzipFile = $folder->newFile($fileName . '.gz');
|
$gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -188,9 +188,9 @@ class SCSSCacher {
|
||||||
|
|
||||||
// Gzip file
|
// Gzip file
|
||||||
try {
|
try {
|
||||||
$gzipFile = $folder->getFile($fileNameCSS . '.gz');
|
$gzipFile = $folder->getFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
|
||||||
} catch (NotFoundException $e) {
|
} catch (NotFoundException $e) {
|
||||||
$gzipFile = $folder->newFile($fileNameCSS . '.gz');
|
$gzipFile = $folder->newFile($fileNameCSS . '.gzip'); # Safari doesn't like .gz
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -121,7 +121,7 @@ class CssControllerTest extends TestCase {
|
||||||
->willReturn($folder);
|
->willReturn($folder);
|
||||||
|
|
||||||
$folder->method('getFile')
|
$folder->method('getFile')
|
||||||
->with('file.css.gz')
|
->with('file.css.gzip')
|
||||||
->willReturn($gzipFile);
|
->willReturn($gzipFile);
|
||||||
|
|
||||||
$this->request->method('getHeader')
|
$this->request->method('getHeader')
|
||||||
|
|
|
@ -120,7 +120,7 @@ class JsControllerTest extends TestCase {
|
||||||
->willReturn($folder);
|
->willReturn($folder);
|
||||||
|
|
||||||
$folder->method('getFile')
|
$folder->method('getFile')
|
||||||
->with('file.js.gz')
|
->with('file.js.gzip')
|
||||||
->willReturn($gzipFile);
|
->willReturn($gzipFile);
|
||||||
|
|
||||||
$this->request->method('getHeader')
|
$this->request->method('getHeader')
|
||||||
|
|
|
@ -111,7 +111,7 @@ class JSCombinerTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($path === 'combine.js.deps') {
|
} else if ($path === 'combine.js.deps') {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
} else if ($path === 'combine.js.gz') {
|
} else if ($path === 'combine.js.gzip') {
|
||||||
return $gzfile;
|
return $gzfile;
|
||||||
}
|
}
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -148,7 +148,7 @@ class JSCombinerTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($path === 'combine.js.deps') {
|
} else if ($path === 'combine.js.deps') {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
} else if ($path === 'combine.js.gz') {
|
} else if ($path === 'combine.js.gzip') {
|
||||||
return $gzfile;
|
return $gzfile;
|
||||||
}
|
}
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -302,7 +302,7 @@ class JSCombinerTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($filename === 'combine.js.deps') {
|
} else if ($filename === 'combine.js.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($filename === 'combine.js.gz') {
|
} else if ($filename === 'combine.js.gzip') {
|
||||||
return $gzFile;
|
return $gzFile;
|
||||||
}
|
}
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -333,7 +333,7 @@ class JSCombinerTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($filename === 'combine.js.deps') {
|
} else if ($filename === 'combine.js.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($filename === 'combine.js.gz') {
|
} else if ($filename === 'combine.js.gzip') {
|
||||||
return $gzFile;
|
return $gzFile;
|
||||||
}
|
}
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -401,7 +401,7 @@ var b = \'world\';
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($filename === 'combine.js.deps') {
|
} else if ($filename === 'combine.js.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($filename === 'combine.js.gz') {
|
} else if ($filename === 'combine.js.gzip') {
|
||||||
return $gzFile;
|
return $gzFile;
|
||||||
}
|
}
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
|
|
@ -81,7 +81,7 @@ class SCSSCacherTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($path === 'styles.css.deps') {
|
} else if ($path === 'styles.css.deps') {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
} else if ($path === 'styles.css.gz') {
|
} else if ($path === 'styles.css.gzip') {
|
||||||
return $gzfile;
|
return $gzfile;
|
||||||
} else {
|
} else {
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -110,7 +110,7 @@ class SCSSCacherTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($path === 'styles.css.deps') {
|
} else if ($path === 'styles.css.deps') {
|
||||||
throw new NotFoundException();
|
throw new NotFoundException();
|
||||||
} else if ($path === 'styles.css.gz') {
|
} else if ($path === 'styles.css.gzip') {
|
||||||
return $gzfile;
|
return $gzfile;
|
||||||
}else {
|
}else {
|
||||||
$this->fail();
|
$this->fail();
|
||||||
|
@ -228,7 +228,7 @@ class SCSSCacherTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($fileName === 'styles.css.deps') {
|
} else if ($fileName === 'styles.css.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($fileName === 'styles.css.gz') {
|
} else if ($fileName === 'styles.css.gzip') {
|
||||||
return $gzipFile;
|
return $gzipFile;
|
||||||
}
|
}
|
||||||
throw new \Exception();
|
throw new \Exception();
|
||||||
|
@ -258,7 +258,7 @@ class SCSSCacherTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($fileName === 'styles.css.deps') {
|
} else if ($fileName === 'styles.css.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($fileName === 'styles.css.gz') {
|
} else if ($fileName === 'styles.css.gzip') {
|
||||||
return $gzipFile;
|
return $gzipFile;
|
||||||
}
|
}
|
||||||
throw new \Exception();
|
throw new \Exception();
|
||||||
|
@ -288,7 +288,7 @@ class SCSSCacherTest extends \Test\TestCase {
|
||||||
return $file;
|
return $file;
|
||||||
} else if ($fileName === 'styles-success.css.deps') {
|
} else if ($fileName === 'styles-success.css.deps') {
|
||||||
return $depsFile;
|
return $depsFile;
|
||||||
} else if ($fileName === 'styles-success.css.gz') {
|
} else if ($fileName === 'styles-success.css.gzip') {
|
||||||
return $gzipFile;
|
return $gzipFile;
|
||||||
}
|
}
|
||||||
throw new \Exception();
|
throw new \Exception();
|
||||||
|
|
Loading…
Reference in New Issue