Merge pull request #490 from qligier/pr-extension
Modifications arround getExtension
This commit is contained in:
commit
f7b294e358
BIN
dist/main.js
vendored
BIN
dist/main.js
vendored
Binary file not shown.
BIN
dist/view.js
vendored
BIN
dist/view.js
vendored
Binary file not shown.
@ -278,7 +278,7 @@ final class Album {
|
||||
if (!@is_readable($photo->url)) continue;
|
||||
|
||||
// Get extension of image
|
||||
$extension = getExtension($photo->url, true);
|
||||
$extension = getExtension($photo->url, false);
|
||||
|
||||
// Set title for photo
|
||||
$zipFileName = $zipTitle . '/' . $photo->title . $extension;
|
||||
|
@ -845,7 +845,7 @@ final class Photo {
|
||||
}
|
||||
|
||||
// Get extension
|
||||
$extension = getExtension($photo->url, true);
|
||||
$extension = getExtension($photo->url, false);
|
||||
if (empty($extension)===true) {
|
||||
Log::error(Database::get(), __METHOD__, __LINE__, 'Invalid photo extension');
|
||||
return false;
|
||||
|
@ -6,11 +6,14 @@
|
||||
*/
|
||||
function getExtension($filename, $isURI = false) {
|
||||
|
||||
// If $filename is an URI, get only the path component
|
||||
# If $filename is an URI, get only the path component
|
||||
if ($isURI===true) $filename = parse_url($filename, PHP_URL_PATH);
|
||||
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
# Special cases
|
||||
if (strpos($extension, ':')!==false) list($extension, ) = explode(':', $extension, 2);
|
||||
|
||||
if (empty($extension)===false) $extension = '.' . $extension;
|
||||
|
||||
return $extension;
|
||||
|
@ -275,11 +275,14 @@ upload.start = {
|
||||
|
||||
basicModal.close()
|
||||
|
||||
/*
|
||||
// Only check for file validity on PHP side
|
||||
let extension = data.link.split('.').pop()
|
||||
if (extension!=='jpeg' && extension!=='jpg' && extension!=='png' && extension!=='gif' && extension!=='webp') {
|
||||
loadingBar.show('error', 'File format of link not supported.')
|
||||
return false
|
||||
}
|
||||
*/
|
||||
|
||||
files[0] = {
|
||||
name : data.link,
|
||||
|
Loading…
Reference in New Issue
Block a user