summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/tests/inc/tar.test.php24
-rw-r--r--inc/parser/parser.php4
2 files changed, 25 insertions, 3 deletions
diff --git a/_test/tests/inc/tar.test.php b/_test/tests/inc/tar.test.php
index 90bc2e49e..28e709cc3 100644
--- a/_test/tests/inc/tar.test.php
+++ b/_test/tests/inc/tar.test.php
@@ -248,6 +248,28 @@ class Tar_TestCase extends DokuWikiTest {
}
}
+ // FS#1442
+ public function test_createlongfile() {
+ $tar = new Tar();
+ $tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
+
+ $path = '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789.txt';
+
+ $tar->create($tmp, Tar::COMPRESS_NONE);
+ $tar->addData($path, 'testcontent1');
+ $tar->close();
+
+ $this->assertTrue(filesize($tmp) > 30); //arbitrary non-zero number
+ $data = file_get_contents($tmp);
+
+ // We should find the complete path and a longlink entry
+ $this->assertTrue(strpos($data, 'testcontent1') !== false, 'content in TAR');
+ $this->assertTrue(strpos($data, $path) !== false, 'path in TAR');
+ $this->assertTrue(strpos($data, '@LongLink') !== false, '@LongLink in TAR');
+
+ @unlink($tmp);
+ }
+
public function test_createlongpathustar() {
$tar = new Tar();
$tmp = tempnam(sys_get_temp_dir(), 'dwtartest');
@@ -360,4 +382,4 @@ class Tar_TestCase extends DokuWikiTest {
$this->assertEquals(512*4, strlen($file)); // 1 header block + data block + 2 footer blocks
}
-} \ No newline at end of file
+}
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 915899f53..6aef3fda5 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -454,8 +454,8 @@ class Doku_Parser_Mode_table extends Doku_Parser_Mode {
}
function connectTo($mode) {
- $this->Lexer->addEntryPattern('\n\^',$mode,'table');
- $this->Lexer->addEntryPattern('\n\|',$mode,'table');
+ $this->Lexer->addEntryPattern('\s*\n\^',$mode,'table');
+ $this->Lexer->addEntryPattern('\s*\n\|',$mode,'table');
}
function postConnect() {