diff --git a/TODO b/TODO index ebab7e75..0a1a3eda 100644 --- a/TODO +++ b/TODO @@ -8,8 +8,6 @@ everything related to posts: - ability to paste many urls in post upload - - generate meaningful file name when saving posts - - post notes - "add note" in sidebar creates new note in the middle of image - hovering notes shows note text diff --git a/public_html/.htaccess b/public_html/.htaccess index 83ae6f1a..3e0484cc 100644 --- a/public_html/.htaccess +++ b/public_html/.htaccess @@ -3,7 +3,7 @@ DirectoryIndex index.html RewriteEngine On -RewriteCond %{REQUEST_FILENAME} !-f +#RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/?data/posts/([^/]+)/? /api/posts/$1/content [L] RewriteCond %{REQUEST_FILENAME} !-f diff --git a/src/Controllers/PostContentController.php b/src/Controllers/PostContentController.php index f27e37c4..7376593a 100644 --- a/src/Controllers/PostContentController.php +++ b/src/Controllers/PostContentController.php @@ -1,6 +1,8 @@ config = $config; $this->fileDao = $fileDao; $this->postService = $postService; $this->networkingService = $networkingService; @@ -34,7 +39,14 @@ final class PostContentController extends AbstractController public function getPostContent($postName) { $post = $this->postService->getByName($postName); - $this->networkingService->serveFile($this->fileDao->getFullPath($post->getContentPath())); + + $options = new \StdClass; + $options->customFileName = sprintf('%s_%s.%s', + $this->config->basic->serviceName, + $post->getName(), + strtolower(MimeHelper::getExtension($post->getContentMimeType()))); + + $this->networkingService->serveFile($this->fileDao->getFullPath($post->getContentPath()), $options); } public function getPostThumbnail($postName, $size)