remove the old keys, if they are still stored

This commit is contained in:
El RIDO 2024-05-01 20:32:39 +02:00
parent a9f1926b96
commit b2db26998d
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
2 changed files with 8 additions and 2 deletions

View file

@ -47,6 +47,12 @@ class Paste extends AbstractModel
$data['meta']['time_to_live'] = $data['meta']['expire_date'] - time();
unset($data['meta']['expire_date']);
}
if (array_key_exists('created', $data['meta'])) {
unset($data['meta']['created']);
}
if (array_key_exists('postdate', $data['meta'])) {
unset($data['meta']['postdate']);
}
// check if non-expired burn after reading paste needs to be deleted
if (

View file

@ -742,7 +742,7 @@ class ControllerTest extends TestCase
$this->assertEquals($paste['adata'][1], $response['adata'][1], 'outputs formatter correctly');
$this->assertEquals($paste['adata'][2], $response['adata'][2], 'outputs opendiscussion correctly');
$this->assertEquals($paste['adata'][3], $response['adata'][3], 'outputs burnafterreading correctly');
$this->assertFalse(array_key_exists('created', $paste['meta']), 'does not output created');
$this->assertFalse(array_key_exists('created', $response['meta']), 'does not output created');
$this->assertEquals(0, $response['comment_count'], 'outputs comment_count correctly');
$this->assertEquals(0, $response['comment_offset'], 'outputs comment_offset correctly');
}
@ -772,7 +772,7 @@ class ControllerTest extends TestCase
$this->assertStringEndsWith('?' . $response['id'], $response['url'], 'returned URL points to new paste');
$this->assertEquals($paste['data'], $response['data'], 'outputs data correctly');
$this->assertEquals('syntaxhighlighting', $response['meta']['formatter'], 'outputs format correctly');
$this->assertEquals($paste['meta']['postdate'], $response['meta']['postdate'], 'outputs postdate correctly');
$this->assertFalse(array_key_exists('postdate', $response['meta']), 'does not output postdate');
$this->assertEquals($paste['meta']['opendiscussion'], $response['meta']['opendiscussion'], 'outputs opendiscussion correctly');
$this->assertEquals(0, $response['comment_count'], 'outputs comment_count correctly');
$this->assertEquals(0, $response['comment_offset'], 'outputs comment_offset correctly');