File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public function __construct(
4040 * try to detect the type of tar compression
4141 */
4242 public static function getTarType (string $ file ): int {
43- if (strpos ($ file , '. ' )) {
43+ if (strrpos ($ file , '. ' ) !== false ) {
4444 $ extension = substr ($ file , strrpos ($ file , '. ' ));
4545 switch ($ extension ) {
4646 case '.gz ' :
Original file line number Diff line number Diff line change 1313use OCP \Server ;
1414
1515class TARTest extends TestBase {
16+ public function testGetTarTypeWithHiddenArchiveNames (): void {
17+ $ this ->assertSame (TAR ::GZIP , TAR ::getTarType ('.tar.gz ' ));
18+ $ this ->assertSame (TAR ::GZIP , TAR ::getTarType ('.tgz ' ));
19+ $ this ->assertSame (TAR ::BZIP , TAR ::getTarType ('.tar.bz2 ' ));
20+ }
21+
1622 #[\Override]
1723 protected function getExisting () {
1824 $ dir = \OC ::$ SERVERROOT . '/tests/data ' ;
You can’t perform that action at this time.
0 commit comments