Issue #1542854 by drumm, BTMash: Fixed system_update_7061() converts filepaths too aggressively.
parent
3a928db505
commit
6af9c29d63
|
@ -114,6 +114,19 @@ db_insert('files')->fields(array(
|
|||
'status' => '1',
|
||||
'timestamp' => '1285708957',
|
||||
))
|
||||
/*
|
||||
* This is a case where the path is repeated twice.
|
||||
*/
|
||||
->values(array(
|
||||
'fid' => '11',
|
||||
'uid' => '1',
|
||||
'filename' => 'crazy-basename.png',
|
||||
'filepath' => '/drupal-6/file/directory/path/drupal-6/file/directory/path/crazy-basename.png',
|
||||
'filemime' => 'image/png',
|
||||
'filesize' => '329',
|
||||
'status' => '1',
|
||||
'timestamp' => '1285708958',
|
||||
))
|
||||
->execute();
|
||||
|
||||
db_insert('node')->fields(array(
|
||||
|
@ -235,8 +248,8 @@ db_insert('node_revisions')->fields(array(
|
|||
'vid' => '53',
|
||||
'uid' => '1',
|
||||
'title' => 'node title 40 revision 53',
|
||||
'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png",
|
||||
'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png",
|
||||
'body' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",
|
||||
'teaser' => "Attachments:\r\nforum-hot-new.png\r\nforum-hot.png\r\nforum-sticky.png\r\nforum-new.png\r\ncrazy-basename.png",
|
||||
'log' => '',
|
||||
'timestamp' => '1285709012',
|
||||
'format' => '1',
|
||||
|
@ -394,4 +407,12 @@ db_insert('upload')->fields(array(
|
|||
'list' => '1',
|
||||
'weight' => '-1',
|
||||
))
|
||||
->values(array(
|
||||
'fid' => '11',
|
||||
'nid' => '40',
|
||||
'vid' => '53',
|
||||
'description' => 'crazy-basename.png',
|
||||
'list' => '1',
|
||||
'weight' => '0',
|
||||
))
|
||||
->execute();
|
||||
|
|
|
@ -64,6 +64,12 @@ class UploadUpgradePathTestCase extends UpgradePathTestCase {
|
|||
}
|
||||
$this->assertIdentical($filenames, $recorded_filenames, 'The uploaded files are present in the same order after the upgrade.');
|
||||
}
|
||||
// Test for the file with repeating basename to only have the streaming
|
||||
// path replaced.
|
||||
$node = node_load(40, 53);
|
||||
$repeated_basename_file = $node->upload[LANGUAGE_NONE][4];
|
||||
$this->assertEqual($repeated_basename_file['uri'], 'private://drupal-6/file/directory/path/crazy-basename.png', "The file with the repeated basename path only had the stream portion replaced");
|
||||
|
||||
// Make sure the file settings were properly migrated.
|
||||
$d6_file_directory_temp = '/drupal-6/file/directory/temp';
|
||||
$d6_file_directory_path = '/drupal-6/file/directory/path';
|
||||
|
|
|
@ -2791,7 +2791,7 @@ function system_update_7061(&$sandbox) {
|
|||
foreach ($revision['file'][LANGUAGE_NONE] as $delta => $file) {
|
||||
// We will convert filepaths to uri using the default scheme
|
||||
// and stripping off the existing file directory path.
|
||||
$file['uri'] = $scheme . str_replace($basename, '', $file['filepath']);
|
||||
$file['uri'] = $scheme . preg_replace('!^' . $basename . '!', '', $file['filepath']);
|
||||
$file['uri'] = file_stream_wrapper_uri_normalize($file['uri']);
|
||||
unset($file['filepath']);
|
||||
// Insert into the file_managed table.
|
||||
|
|
Loading…
Reference in New Issue