Skip to content

Commit

Permalink
Made compatible both with guzzle/psr7 v1 and v2
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Jul 7, 2021
1 parent 8f9806a commit 9499886
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": ">=8",
"guzzlehttp/guzzle": "^7",
"acdh-oeaw/arche-lib": "^2.0.0-alpha",
"acdh-oeaw/arche-lib": "^2.0.4",
"acdh-oeaw/easyrdf": ">=0.13.3",
"acdh-oeaw/uri-normalizer": "*",
"zozlak/rdf-constants": "^1.1"
Expand Down
6 changes: 1 addition & 5 deletions src/acdhOeaw/arche/lib/ingest/schema/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
*/
class File extends SchemaObject {

const GUZZLE_PSR7_V1_MIME_FUNC = '\GuzzleHttp\Psr7\mimetype_from_filename';
const GUZZLE_PSR7_V2_MIME_FUNC = '\GuzzleHttp\Psr7\MimeType::fromFilename';

/**
* File path
* @var string
Expand Down Expand Up @@ -173,8 +170,7 @@ public function setMetaLookup(MetaLookupInterface $metaLookup,
* @return string
*/
public function getMime(): ?string {
$f = function_exists(self::GUZZLE_PSR7_V1_MIME_FUNC) ? self::GUZZLE_PSR7_V1_MIME_FUNC : self::GUZZLE_PSR7_V2_MIME_FUNC;
$mime = $f(basename($this->path));
$mime = BinaryPayload::guzzleMimetype(basename($this->path));
if ($mime === null) {
$mime = mime_content_type($this->path);
}
Expand Down

0 comments on commit 9499886

Please sign in to comment.