Skip to content

Commit

Permalink
Merge pull request #10 from RunsTp/master
Browse files Browse the repository at this point in the history
🐛 fix some issues
  • Loading branch information
kiss291323003 authored May 19, 2020
2 parents cf5d157 + d0b5085 commit 109f4d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"autoload-dev": {
"psr-4": {
"EasySwoole\\Utility\\Tests": "tests/"
"EasySwoole\\Utility\\Tests\\": "tests/"
}
}
}
11 changes: 10 additions & 1 deletion src/Mime/MimeDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function setFile(string $filePath): self
*/
public function setStream(string $stream): self
{
$this->stream = $stream;
$this->stream = $this->preStream($stream);
$this->createByteCache();
return $this;
}
Expand Down Expand Up @@ -1159,4 +1159,13 @@ protected function readFile(string $filePath): string
fclose($handle);
return $stream;
}

/**
* @param string $stream
* @return string
*/
protected function preStream(string $stream): string
{
return substr($stream, 0, $this->maxByteCacheLen);
}
}

0 comments on commit 109f4d8

Please sign in to comment.