* fixed remote search driver js bug in file check
authorMichael Dale <dale@users.mediawiki.org>
Thu, 8 Oct 2009 05:47:18 +0000 (05:47 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 8 Oct 2009 05:47:18 +0000 (05:47 +0000)
js2/mwEmbed/libAddMedia/remoteSearchDriver.js

index 115698d..6e8370f 100644 (file)
@@ -1256,8 +1256,12 @@ remoteSearchDriver.prototype = {
                        //local repo jump directly to check Import Resource callback:
                         cir_callback( rObj );
                }else{                  
-                       //check if the orginal  
-                       _this.checkForFile(     
+                       //check if the file is local (can be shared repo)  
+                       _this.checkForFile(rObj.target_resource_title, function(imagePage){
+                               if( imagePage ){
+                                        cir_callback( rObj );
+                               }
+                       });
                        //update target_resource_title with resource repository prefix:
                        rObj.target_resource_title = cp.resource_prefix + rObj.target_resource_title;
                        reqObj['titles'] = _this.cFileNS + ':' + rObj.target_resource_title,                                            
@@ -1374,8 +1378,8 @@ remoteSearchDriver.prototype = {
                                                        $j(this).remove();
                                                });
                                        });
-                               }
-                       );
+                               }                       
+                       });
                }
        },
        checkForFile:function( fName, callback){