Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Added urlencode to filename for attachments #130

Closed
wants to merge 2 commits into from

Conversation

Tischi86
Copy link

Encoding the filename makes it possible to get attachments with spaces.

Encoding the filename makes it possible to get attachments with spaces.
@@ -291,7 +291,7 @@ private function createDocumentAttachments($documentId, $data)
$basePath = '/' . $this->dm->getCouchDBClient()->getDatabase() . '/' . $documentId . '/';
foreach ($data AS $filename => $attachment) {
if (isset($attachment['stub']) && $attachment['stub']) {
$instance = Attachment::createStub($attachment['content_type'], $attachment['length'], $attachment['revpos'], $client, $basePath . $filename);
$instance = Attachment::createStub($attachment['content_type'], $attachment['length'], $attachment['revpos'], $client, $basePath . urlencode($filename));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure this is something that the Attachment class should fix, not the calling code. Or?

@Tischi86
Copy link
Author

@Tischi86 Tischi86 closed this Apr 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants