Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed contenttype header being null #1191

Merged
merged 2 commits into from Sep 26, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -686,9 +686,11 @@ public function propFindLate(DAV\PropFind $propFind, DAV\INode $node)
return;
}
$contentType = $propFind->get('{DAV:}getcontenttype');
list($part) = explode(';', $contentType);
if ('text/x-vcard' === $part || 'text/vcard' === $part) {
$propFind->set('{DAV:}getcontenttype', 'text/x-vcard');
if (null !== $contentType) {
list($part) = explode(';', $contentType);
if ('text/x-vcard' === $part || 'text/vcard' === $part) {
$propFind->set('{DAV:}getcontenttype', 'text/x-vcard');
}
}
}
@@ -53,4 +53,15 @@ public function testDontTouchOtherMimeTypes()
$this->carddavPlugin->propFindLate($propFind, new \Sabre\DAV\SimpleCollection('foo'));
$this->assertEquals('text/plain', $propFind->get('{DAV:}getcontenttype'));
}
public function testStripWithoutGetContentType()
{
$this->server->httpRequest = new HTTP\Request('GET', '/addressbooks/user1/book1/card1.vcf', [
'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 Lightning/1.2.1',
]);
$propFind = new PropFind('hello', ['{DAV:}getcontenttype']);
$this->carddavPlugin->propFindLate($propFind, new \Sabre\DAV\SimpleCollection('foo'));
$this->assertEquals(null, $propFind->get('{DAV:}getcontenttype')); // Property not present
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.