Skip to content

Commit 76f6b7b

Browse files
committed
fix: normalizes mime type value for comparison
1 parent af53eaf commit 76f6b7b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Files/ValueObjects/MimeType.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function __construct(string $value)
108108
);
109109
}
110110

111-
$this->value = $value;
111+
$this->value = strtolower($value);
112112
}
113113

114114
/**
@@ -236,7 +236,13 @@ public function equals($other): bool
236236
return $this->value === $other->value;
237237
}
238238

239-
return $this->value === $other;
239+
if (is_string($other)) {
240+
return $this->value === strtolower($other);
241+
}
242+
243+
throw new \InvalidArgumentException(
244+
sprintf('Invalid MIME type comparison: %s', gettype($other))
245+
);
240246
}
241247

242248
/**

0 commit comments

Comments
 (0)