Whitelist `tsv` extension when opening CSV files

Fixes #429
This commit is contained in:
Adrien Crivelli 2019-05-26 20:05:45 +12:00
parent 84e09df798
commit 27255ce808
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com) The format is based on [Keep a Changelog](https://keepachangelog.com)
and this project adheres to [Semantic Versioning](https://semver.org). and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
### Fixed
- Whitelist `tsv` extension when opening CSV files [#429](https://github.com/PHPOffice/PhpSpreadsheet/issues/429)
## [1.7.0] - 2019-05-26 ## [1.7.0] - 2019-05-26
### Added ### Added

View File

@ -545,7 +545,8 @@ class Csv extends BaseReader
fclose($this->fileHandle); fclose($this->fileHandle);
// Trust file extension if any // Trust file extension if any
if (strtolower(pathinfo($pFilename, PATHINFO_EXTENSION)) === 'csv') { $extension = strtolower(pathinfo($pFilename, PATHINFO_EXTENSION));
if (in_array($extension, ['csv', 'tsv'])) {
return true; return true;
} }