Skip to content

Commit

Permalink
fix: don't make api calls if file has no extension
Browse files Browse the repository at this point in the history
  • Loading branch information
carlalexander committed Sep 7, 2020
1 parent 84d4bc1 commit b0d206a
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 104 deletions.
4 changes: 3 additions & 1 deletion src/CloudStorage/CloudStorageStreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,9 @@ private function getStat(string $key, array $details = [])
12 => -1, 'blocks' => -1,
];

if (empty($key)) {
// Avoid doing API calls if the given object key has no extension. "wp_upload_dir" does a lot
// of file checks to create directories and that impacts performance significantly.
if (empty($key) || empty(pathinfo($key, PATHINFO_EXTENSION))) {
return $stat;
}

Expand Down
Loading

0 comments on commit b0d206a

Please sign in to comment.