Skip to content

Commit

Permalink
Update File Entity to 7.x-2.33
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Hunt committed Dec 14, 2021
1 parent 13a8bbf commit b40fd76
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ configure = admin/config/media/file-settings
; We have to add a fake version so Git checkouts do not fail Media dependencies
version = 7.x-2.x-dev

; Information added by Drupal.org packaging script on 2020-06-15
version = "7.x-2.30"
; Information added by Drupal.org packaging script on 2021-11-10
version = "7.x-2.33"
core = "7.x"
project = "file_entity"
datestamp = "1592259102"
datestamp = "1636506143"
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,22 @@ function file_entity_download_page($file) {
return MENU_NOT_FOUND;
}
// @todo Why basename? Why not drupal_basename which was working up until recently.
$content_type = '';
if (isset($file->filemime)) {
$content_type = mime_header_encode($file->filemime);
// Strip new lines for php 8.0 compatibility with headers.
$content_type = str_replace(array("\n\r", "\n", "\r"), '', $content_type);
}
$disposition = '';
if (isset($file->uri)) {
$disposition = mime_header_encode(basename($file->uri));
// Strip new lines for php 8.0 compatibility with headers.
$disposition = str_replace(array("\n\r", "\n", "\r"), '', $disposition);
}

$headers = array(
'Content-Type' => mime_header_encode($file->filemime),
'Content-Disposition' => 'attachment; filename="' . mime_header_encode(basename($file->uri)) . '"',
'Content-Type' => $content_type,
'Content-Disposition' => 'attachment; filename="' . $disposition . '"',
'Content-Length' => $file->filesize,
'Content-Transfer-Encoding' => 'binary',
'Pragma' => 'no-cache',
Expand Down Expand Up @@ -1260,9 +1273,12 @@ function file_entity_get_upload_validators(array $options = array()) {
$validators['file_validate_extensions'] = array(variable_get('file_entity_default_allowed_extensions', 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv weba webp webm'));
}

// Cap the upload size according to the system or user defined limit.
$max_filesize = parse_size(file_upload_max_size());
$file_entity_max_filesize = parse_size(variable_get('file_entity_max_filesize', ''));
// Cap the upload size according to the system or user defined limit. Note: In
// PHP 8 file_upload_max_size() returns a string instead of an integer, so
// cast it to an integer to avoid a critical error; do the same for the
// variable, just in case.
$max_filesize = parse_size(intval(file_upload_max_size()));
$file_entity_max_filesize = parse_size(intval(variable_get('file_entity_max_filesize', '')));

// If the user defined a size limit, use the smaller of the two.
if (!empty($file_entity_max_filesize)) {
Expand Down
26 changes: 13 additions & 13 deletions docroot/sites/all/modules/contrib/file_entity/file_entity.test
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class FileEntityFileTypeClassificationTestCase extends DrupalWebTestCase {
return array(
'name' => 'File entity classification',
'description' => 'Test existing file entity classification functionality.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -206,7 +206,7 @@ class FileEntityUnitTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity unit tests',
'description' => 'Test basic file entity functionality.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -311,7 +311,7 @@ class FileEntityEditTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity edit',
'description' => 'Create a file and test file edit functionality.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -421,7 +421,7 @@ class FileEntityUploadWizardTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity upload wizard',
'description' => 'Upload a file using the multi-step wizard.',
'group' => 'File entity',
'group' => 'file_entity',
'dependencies' => array('token'),
);
}
Expand Down Expand Up @@ -646,7 +646,7 @@ class FileEntityAdminTestCase extends FileEntityTestHelper {
return array(
'name' => 'File administration',
'description' => 'Test file administration page functionality.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -809,7 +809,7 @@ class FileEntityUsageTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity usage',
'description' => 'Create a file and verify its usage.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -896,7 +896,7 @@ class FileEntityAltTitleTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity alt and title text',
'description' => 'Create an image file with alt and title text.',
'group' => 'File entity',
'group' => 'file_entity',
'dependencies' => array('token'),
);
}
Expand Down Expand Up @@ -987,7 +987,7 @@ class FileEntityChangeSchemeTestCase extends FileEntityTestHelper {
return array(
'name' => 'Changing file scheme',
'description' => 'Test changing the scheme of a file.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -1025,7 +1025,7 @@ class FileEntityReplaceTestCase extends FileEntityTestHelper {
return array(
'name' => 'File replacement',
'description' => 'Test file replace functionality.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -1109,7 +1109,7 @@ class FileEntityTokenTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity tokens',
'description' => 'Test the file entity tokens.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -1167,7 +1167,7 @@ class FileEntityTypeTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity types',
'description' => 'Test the file entity types.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -1296,7 +1296,7 @@ class FileEntityAccessTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity access',
'description' => 'Test the access aspects of file entity.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down Expand Up @@ -1639,7 +1639,7 @@ class FileEntityAttributeOverrideTestCase extends FileEntityTestHelper {
return array(
'name' => 'File entity attribute override',
'description' => 'Test overriding file entity attributes.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ function file_entity_token_info() {
$entity_type = 'term';
}
$info['tokens'][$entity_type][$field_name] = array(
'name' => $field_info['label'],
'description' => $field_info['description'],
'name' => ($field_info) ? $field_info['label'] : '',
'description' => ($field_info) ? $field_info['description'] : '',
'type' => 'file_field',
'module' => 'file_entity',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FileEntityViewsFieldLinkUsageHandlerTest extends FileEntityTestHelper {
return array(
'name' => 'File entity views integration: file link usage',
'description' => 'Test file usage Views field.',
'group' => 'File entity',
'group' => 'file_entity',
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ core = 7.x
dependencies[] = file_entity
hidden = TRUE

; Information added by Drupal.org packaging script on 2020-06-15
version = "7.x-2.30"
; Information added by Drupal.org packaging script on 2021-11-10
version = "7.x-2.33"
core = "7.x"
project = "file_entity"
datestamp = "1592259102"
datestamp = "1636506143"

0 comments on commit b40fd76

Please sign in to comment.