From c5324842031dddb6a539d04d30a0b5752d34af43 Mon Sep 17 00:00:00 2001 From: freek Date: Mon, 11 May 2015 17:01:52 +0200 Subject: [PATCH] allow files without an extension --- CHANGELOG.md | 3 +++ src/MediaLibraryRepository.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6290bb05..47ad52756 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All Notable changes to `laravel-medialibrary` will be documented in this file +##1.1.2 +- Files without extensions are now allowed + ##1.1.1 - Added check to make sure the file that must be added to the medialibrary exists diff --git a/src/MediaLibraryRepository.php b/src/MediaLibraryRepository.php index ad88d3904..454ea6bf2 100644 --- a/src/MediaLibraryRepository.php +++ b/src/MediaLibraryRepository.php @@ -162,7 +162,7 @@ private function createMediaForFile($file, $collectionName, $addAsTemporary) $media->name = $pathParts['filename']; $media->url = $pathParts['basename']; $media->path = $pathParts['basename']; - $media->extension = strtolower($pathParts['extension']); + $media->extension = isset($pathParts['extension']) ? strtolower($pathParts['extension']) : ''; $media->size = filesize($file); $media->temp = $addAsTemporary; $media->collection_name = $collectionName;