]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove redundant code from OC_Helper::linkTo
authorBart Visscher <bartv@thisnet.nl>
Thu, 28 Jun 2012 19:26:03 +0000 (21:26 +0200)
committerBart Visscher <bartv@thisnet.nl>
Thu, 28 Jun 2012 20:11:04 +0000 (22:11 +0200)
lib/helper.php

index 6ab55f27618154006faf1ca4d54cd7fa5cc77166..64378da356e717c7e68929e19870a50416405d89 100644 (file)
@@ -38,13 +38,10 @@ class OC_Helper {
         */
        public static function linkTo( $app, $file ){
                if( $app != '' ){
-                       $app .= '/';
+                       $app_path = OC_App::getAppPath($app);
                        // Check if the app is in the app folder
-                       if( file_exists( OC_App::getAppPath($app).'/'.$file )){
+                       if( $app_path && file_exists( $app_path.'/'.$file )){
                                if(substr($file, -3) == 'php' || substr($file, -3) == 'css'){   
-                                       if(substr($app, -1, 1) == '/'){
-                                               $app = substr($app, 0, strlen($app) - 1);
-                                       }
                                        $urlLinkTo =  OC::$WEBROOT . '/?app=' . $app;
                                        $urlLinkTo .= ($file!='index.php')?'&getfile=' . urlencode($file):'';
                                }else{
@@ -52,7 +49,7 @@ class OC_Helper {
                                }
                        }
                        else{
-                               $urlLinkTo =  OC::$WEBROOT . '/' . $app . $file;
+                               $urlLinkTo =  OC::$WEBROOT . '/' . $app . '/' . $file;
                        }
                }
                else{