From 44c54c48f64b606dab9ec3595132dc725c09fce8 Mon Sep 17 00:00:00 2001 From: Quentin Ligier Date: Thu, 17 Mar 2016 19:21:59 +0100 Subject: [PATCH] Modifications arround getExtension --- dist/main.js | Bin 192330 -> 192192 bytes dist/view.js | Bin 106865 -> 106897 bytes php/Modules/Album.php | 2 +- php/Modules/Photo.php | 2 +- php/helpers/getExtension.php | 5 ++++- src/scripts/upload.js | 3 +++ 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/main.js b/dist/main.js index 3ed2e4bace876727502e9ee46829a2295fd635a0..3ffd9ee0c01e8917f4b84577a75f0204e9a07abe 100644 GIT binary patch delta 2164 zcmZuyeQXkI;82oMtD5HI|JHa5Yu{R8D-H?3mrfTF5XSGGw-La?o3fF=#ZR?5c&h3Arp zc8GuO`MBqO-skzfzvq1~zq#$gZ?=7ZdS@%IYK0Qzy|S$Nd^{x;suYQ`Zda>TW#{L1 zK*GG$x(5!Q6Eud_*h~S}JPZu;U@YjIJ59Sjten=<|6sbSU|}KqUT-AH0aa z%!iM($E(#ds}ipo6GffsbfrMXbG&#vV@@v$)T3%1BKB@<<5||#tfy0!Wm>J?&Q7hz zkF3>V@pb(YhkYFy{5gLAId}=%x;XTtt1gkQRt1_&Sc|dGz+DKBR}&OTmsGJ@HE+dR zOl41lDUR-KNThu}L6zqORTL!!;}l#pJ^FwH(07gv)-)$%-cV1U&J#Wm_G_f<8CEEf zV%DvR8}9a4Ff*^_v&Z!;F+}O3)`?`y+WE-|2V!Nqj^h%Nxt44&Kb368)GT?nrX>;J z5A@v^Qu^*QNS>Qk;r7-Q(XY6LYr zmMQ${^M(J9@96)A;rbhIjJIMhL+`)hO$2F~5RDX#q?VRHVpXfjw3IMI9}MnE1Peuy zQ}Yz#f+fwES94S#VkBXG@q=M#)k^uiSJs0|B~rpNHWjCbPTcK}H>Mmk2XFehS}*na zG~{ORY?Jk+za8c9D1P>j*DUtoquV&iVAoyH$bPW}b~Ip|K!Y2EA=$W=B^8PN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ephZaA8zUA zfr|SCWh%S$`W6fJ6E<;9>c+I>{LZC+ohFJM0y*tC7QMU1wcHfGrAxzYr2&mzvehA& zkZ|7WJ}pUgAw$&^OD}TfH}}GX#C_r=+yBoyh4%4gMF%_r{pPU_XkXLM_~i@s+i!M& qQ~{lKT@-3cA#C0^03w8KeE?qDWcJL$w_vq-Y8KYpAI-w!{J#MvD3SmG diff --git a/php/Modules/Album.php b/php/Modules/Album.php index 253d224..01c71bb 100644 --- a/php/Modules/Album.php +++ b/php/Modules/Album.php @@ -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; diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index f7e3684..38d82fd 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -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; diff --git a/php/helpers/getExtension.php b/php/helpers/getExtension.php index 180a853..4ac8b55 100644 --- a/php/helpers/getExtension.php +++ b/php/helpers/getExtension.php @@ -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; diff --git a/src/scripts/upload.js b/src/scripts/upload.js index d99d6c1..effdb4f 100755 --- a/src/scripts/upload.js +++ b/src/scripts/upload.js @@ -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,