diff options
-rw-r--r-- | lib/private/files/cache/scanner.php | 4 | ||||
-rw-r--r-- | lib/private/mail/mailer.php | 5 | ||||
-rw-r--r-- | tests/lib/files/cache/scanner.php | 23 | ||||
-rw-r--r-- | tests/lib/mail/mailer.php | 2 |
4 files changed, 32 insertions, 2 deletions
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php index dbffba1e306..b0890dcdc00 100644 --- a/lib/private/files/cache/scanner.php +++ b/lib/private/files/cache/scanner.php @@ -408,6 +408,10 @@ class Scanner extends BasicEmitter { if (pathinfo($file, PATHINFO_EXTENSION) === 'part') { return true; } + if (strpos($file, '.part/') !== false) { + return true; + } + return false; } diff --git a/lib/private/mail/mailer.php b/lib/private/mail/mailer.php index d083b992326..bd93f3e3d58 100644 --- a/lib/private/mail/mailer.php +++ b/lib/private/mail/mailer.php @@ -157,7 +157,10 @@ class Mailer implements IMailer { $this->instance = $this->getSMTPInstance(); break; case 'sendmail': - $this->instance = $this->getSendMailInstance(); + // FIXME: Move into the return statement but requires proper testing + // for SMTP and mail as well. Thus not really doable for a + // minor release. + $this->instance = \Swift_Mailer::newInstance($this->getSendMailInstance()); break; default: $this->instance = $this->getMailInstance(); diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php index b44cf0a49df..871b12bac3a 100644 --- a/tests/lib/files/cache/scanner.php +++ b/tests/lib/files/cache/scanner.php @@ -284,4 +284,27 @@ class Scanner extends \Test\TestCase { $cachedData = $this->cache->get('folder/bar.txt'); $this->assertEquals($newFolderId, $cachedData['parent']); } + + /** + * @dataProvider dataTestIsPartialFile + * + * @param string $path + * @param bool $expected + */ + public function testIsPartialFile($path, $expected) { + $this->assertSame($expected, + $this->scanner->isPartialFile($path) + ); + } + + public function dataTestIsPartialFile() { + return [ + ['foo.txt.part', true], + ['/sub/folder/foo.txt.part', true], + ['/sub/folder.part/foo.txt', true], + ['foo.txt', false], + ['/sub/folder/foo.txt', false], + ]; + } + } diff --git a/tests/lib/mail/mailer.php b/tests/lib/mail/mailer.php index 21565f9ffb5..8023cda820e 100644 --- a/tests/lib/mail/mailer.php +++ b/tests/lib/mail/mailer.php @@ -77,7 +77,7 @@ class MailerTest extends TestCase { ->method('getSystemValue') ->will($this->returnValue('sendmail')); - $this->assertInstanceOf('\Swift_SendmailTransport', self::invokePrivate($this->mailer, 'getInstance')); + $this->assertInstanceOf('\Swift_Mailer', self::invokePrivate($this->mailer, 'getInstance')); } public function testCreateMessage() { |