Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPC-9989: Apply a core patch from #3487488 that fixes an issue with mime type detection, update mime types of affected files #1272

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Issue #3001188: Make it possible to add relationships to layout builder": "./patches/3001188-make-it-possible-to-add-relationships-to-layout-builder.patch",
"Issue #2329253: Allow the ChangedItem to skip updating the entity's changed timestamp when synchronizing (f.e. when migrating)": "https://www.drupal.org/files/issues/2024-07-30/2329253-10.x.patch",
"Issue #3467860: Ensure consistent library ordering between page an asset requests when calculating asset aggregates": "./patches/3467860.mr-9219.patch",
"Issue #3487488: ExtensionMimeTypeGuesser::guessMimeType must support file names with '0' (zero) in the extension parts like foo.0.zip": "https://git.drupalcode.org/project/drupal/-/commit/0475ceccefc.patch",
"Issue #?? (maybe #2837833): 'Required contexts without a value": "./patches/missing-context-value-in-layout-builder-admin.patch"
},
"drupal/flat_taxonomy": {
Expand Down
25 changes: 25 additions & 0 deletions html/modules/custom/ghi_image/ghi_image.deploy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/**
* @file
* Contains deploy functions for the GHI image module.
*/

/**
* Fix some mime types after applying core patch from #3487488.
*/
function ghi_image_deploy_fix_mime_types(&$sandbox) {
/** @var \Drupal\file\FileInterface[] $files */
$files = \Drupal::entityTypeManager()->getStorage('file')->loadByProperties([
'filemime' => 'application/octet-stream',
]);
/** @var \Drupal\Core\File\MimeType\MimeTypeGuesser $mime_type_guesser */
$mime_type_guesser = \Drupal::service('file.mime_type.guesser');
foreach ($files as $file) {
$mime_type = $mime_type_guesser->guessMimeType($file->getFileUri());
if ($file->getMimeType() != $mime_type) {
$file->setMimeType($mime_type);
$file->save();
}
}
}
Loading