Skip to content

Commit

Permalink
Whitelist tsv extension when opening CSV files
Browse files Browse the repository at this point in the history
Fixes #429
  • Loading branch information
PowerKiKi committed May 26, 2019
1 parent 84e09df commit 27255ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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

### Added
Expand Down
3 changes: 2 additions & 1 deletion src/PhpSpreadsheet/Reader/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ public function canRead($pFilename)
fclose($this->fileHandle);

// 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;
}

Expand Down

0 comments on commit 27255ce

Please sign in to comment.