Skip to content

Commit 9b9621b

Browse files
authored
Merge pull request dokuwiki#4351 from eduardomozart/patch-5
Fix MD5 RPC page hash calculation
2 parents d07a9ff + 6535a28 commit 9b9621b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

_test/tests/Remote/ApiCoreTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testlistPagesAll()
175175
'permission' => 8,
176176
'size' => filesize($file1),
177177
'revision' => filemtime($file1),
178-
'hash' => md5(io_readFile($file1)),
178+
'hash' => md5(trim(io_readFile($file1))),
179179
'author' => '',
180180
],
181181
[
@@ -184,7 +184,7 @@ public function testlistPagesAll()
184184
'permission' => 8,
185185
'size' => filesize($file2),
186186
'revision' => filemtime($file2),
187-
'hash' => md5(io_readFile($file2)),
187+
'hash' => md5(trim(io_readFile($file2))),
188188
'author' => '',
189189
]
190190
];
@@ -438,7 +438,7 @@ public function testGetPageInfo()
438438
'id' => $id,
439439
'revision' => $rev2,
440440
'author' => 'testuser',
441-
'hash' => md5(io_readFile($file)),
441+
'hash' => md5(trim(io_readFile($file))),
442442
'title' => $id,
443443
'size' => filesize($file),
444444
'permission' => 8,

inc/Remote/Response/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function retrieveTitle()
8686
*/
8787
public function calculateHash()
8888
{
89-
$this->hash = md5(io_readFile($this->file));
89+
$this->hash = md5(trim(io_readFile($this->file)));
9090
}
9191

9292
/**

0 commit comments

Comments
 (0)