Просмотр исходного кода

#3384 Automatic redirect from local storage to remote storage if some references still point to local storage

Alex Trofimov 5 лет назад
Родитель
Сommit
8d46a4aa93
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      storage.php

+ 6 - 3
storage.php

@@ -33,11 +33,14 @@ if (!$sRemoteId) {
 $aObject = $oStorage->getObjectData();
 if ('Local' != $aObject['engine']) {
     if (!($sUrl = $oStorage->getFileUrlByRemoteId($sFile))) {
+
+        $sFile = preg_replace("/\.[A-Za-z0-9]+$/", '', $sFile);
+        $sUrl = $oStorage->getFileUrlByRemoteId($sFile);
+
         // Tmp fix for storages renaming in the past
-        if ('bx_posts_files' == $sStorageObject && ($oStorage = BxDolStorage::getObjectInstance('bx_posts_covers'))) {
-            $sFile = preg_replace("/\.[A-Za-z0-9]+$/", '', $sFile);
+        if (!$sUrl && 'bx_posts_files' == $sStorageObject && ($oStorage = BxDolStorage::getObjectInstance('bx_posts_covers'))) 
             $sUrl = $oStorage->getFileUrlByRemoteId($sFile);
-        }
+
         if (!$sUrl) {
             bx_storage_download_error_occured();
             exit;