Skip to content

Commit 5a0ef00

Browse files
authored
Merge pull request #105 from funktechno/f/image_view_fix
fix image regex viewer
2 parents f8fecb2 + ec17a32 commit 5a0ef00

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

ChangeLog.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Version 0.5.0
4+
* contributors: @imfx77
45

56
---
67

@@ -34,6 +35,7 @@ Actions like changing the parent shouldn't trigger new editions to avoid unneces
3435
* Improved this very `ChangeLog`, transforming it into MD.
3536

3637
### Bug fixes:
38+
* Fixed file viewer
3739
* Fixed routes for all controller actions in use.
3840
They used to be copy pasted and were useless as they were all the same.
3941
Minimalistic possible and sensible notation is proposed.

Controller/WikiFileViewController.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ public function thumbnail()
5959
{
6060
$file = $this->wikiFileModel->getById($this->request->getIntegerParam('file_id'));
6161
$filename = $this->wikiFileModel->getThumbnailPath($file['path']);
62+
63+
$etag = md5($filename);
6264

63-
$this->response->withCache(5 * 86400, $file['etag']);
65+
$this->response->withCache(5 * 86400, $etag);
6466
$this->response->withContentType('image/png');
6567

66-
if ($this->request->getHeader('If-None-Match') === '"'.$file['etag'].'"') {
68+
if ($this->request->getHeader('If-None-Match') === '"'.$etag.'"') {
6769
$this->response->status(304);
6870
} else {
6971
$this->response->send();

Template/wiki_file/images.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<?= $this->app->component('image-slideshow', array(
66
'images' => $images,
77
'image' => $file,
8-
'regex_file_id' => 'FILE_ID',
9-
'regex_etag' => 'ETAG',
8+
'regex' => 'FILE_ID',
109
'url' => array(
1110
'image' => $this->url->to('WikiFileViewController', 'image', array('plugin' => 'wiki', 'file_id' => 'FILE_ID')),
1211
'thumbnail' => $this->url->to('WikiFileViewController', 'thumbnail', array('plugin' => 'wiki', 'file_id' => 'FILE_ID')),

0 commit comments

Comments
 (0)