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

Use MimeTypeGuesserInterface. #53

Merged
merged 1 commit into from
Jul 20, 2023
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"drupal/token": "^1.3"
},
"conflict": {
"drupal/core": "<=8"
"drupal/core": "<9.1"
},
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion openseadragon.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'OpenSeadragon Viewer'
type: module
description: 'A light-weight, customizable OpenSeadragon field formatter'
package: Media
core_version_requirement: ^9 || ^10
core_version_requirement: ^9.1 || ^10
dependencies:
- token:token
configure: openseadragon.admin_settings
10 changes: 5 additions & 5 deletions src/File/FileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Drupal\file\Entity\File;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Mime\MimeTypesInterface;
use Symfony\Component\Mime\MimeTypeGuesserInterface;

/**
* Gets file information for the image to be viewed.
Expand All @@ -16,17 +16,17 @@ class FileInformation implements FileInformationInterface {
/**
* File MimeType Guesser to use extension to determine file type.
*
* @var \Symfony\Component\Mime\MimeTypesInterface
* @var \Symfony\Component\Mime\MimeTypeGuesserInterface
*/
private $mimetypeGuesser;

/**
* FileInformation constructor.
*
* @param \Symfony\Component\Mime\MimeTypesInterface $mimeTypeGuesser
* @param \Symfony\Component\Mime\MimeTypeGuesserInterface $mimeTypeGuesser
* File mimetype guesser interface.
*/
public function __construct(MimeTypesInterface $mimeTypeGuesser) {
public function __construct(MimeTypeGuesserInterface $mimeTypeGuesser) {
$this->mimetypeGuesser = $mimeTypeGuesser;
}

Expand All @@ -51,7 +51,7 @@ public function getFileData(File $file) {
$mime_type = $file->getMimeType();
if (strpos($mime_type, 'image/') === FALSE) {
// Try a better mimetype guesser.
$mime_type = $this->mimetypeGuesser->guess($uri);
$mime_type = $this->mimetypeGuesser->guessMimeType($uri);
if (strpos($mime_type, 'image/') === FALSE) {
// If we still don't have an image. Exit.
return $output;
Expand Down