Index: /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 46614)
+++ /trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 46615)
@@ -2686,5 +2686,4 @@
                 ovf::DiskImage diCurrent = oit->second;
                 ovf::VirtualDisksMap::const_iterator itVDisk = vsysThis.mapVirtualDisks.begin();
-                bool fFoundInCurrentPosition = false;
 
                 VirtualSystemDescriptionEntry *vsdeTargetHD = 0;
@@ -2735,4 +2734,13 @@
                 if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
                 {
+                    /* It means that we possibly have imported the storage earlier on the previous loop steps*/
+                    std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
+                    if (h != disksResolvedNames.end())
+                    {
+                        /* Yes, disk name was found, we can skip it*/
+                        ++oit;
+                        continue;
+                    }
+
                     RTCString availableImage(diCurrent.strHref);
 
@@ -2746,19 +2754,4 @@
                         if(availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
                         {
-
-                            if (RTPathHaveExt(availableImage.c_str()))
-                            {
-                                /* Figure out which format the user have. */
-                                char *pszExt = RTPathExt(availableImage.c_str());
-                                /* Get the system properties. */
-                                SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
-                                ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
-                                if (trgFormat.isNull())
-                                {
-                                    ++oit;
-                                    continue;
-                                }
-                            }
-
                             /* 
                              * 
@@ -2819,5 +2812,4 @@
                         else
                         {
-                            fFoundInCurrentPosition = true;
                             ++oit;
                         }
@@ -2832,17 +2824,5 @@
                 {
                     /* just continue with normal files*/
-                    fFoundInCurrentPosition = true;
                     ++oit;
-                }
-
-                /* It means that we possibly have imported the storage earlier on the previous loop steps*/
-                if (!fFoundInCurrentPosition)
-                {
-                    std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
-                    if (h != disksResolvedNames.end())
-                    {
-                        /* Yes, disk name was found, we can skip it*/
-                        continue;
-                    }
                 }
 
@@ -3140,5 +3120,5 @@
     while(oit != stack.mapDisks.end())
     {
-        if (RTPathHaveExt(oit->first.c_str()))
+        if (RTPathHaveExt(oit->second.strHref.c_str()))
         {
             /* Figure out which format the user have. */
@@ -3155,5 +3135,4 @@
 
         ovf::DiskImage diCurrent = oit->second;
-        bool fFoundInCurrentPosition = false;
 
         VirtualSystemDescriptionEntry *vsdeTargetHD = 0;
@@ -3192,4 +3171,13 @@
         if (strncmp(pStorage->pVDImageIfaces->pszInterfaceName, name.c_str(), name.length()) == 0)
         {
+            /* It means that we possibly have imported the storage earlier on the previous loop steps*/
+            std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
+            if (h != disksResolvedNames.end())
+            {
+                /* Yes, disk name was found, we can skip it*/
+                ++oit;
+                continue;
+            }
+
             RTCString availableImage(diCurrent.strHref);
 
@@ -3203,18 +3191,4 @@
                 if(availableImage.compare(diCurrent.strHref, Utf8Str::CaseInsensitive) != 0)
                 {
-                    if (RTPathHaveExt(availableImage.c_str()))
-                    {
-                        /* Figure out which format the user have. */
-                        char *pszExt = RTPathExt(availableImage.c_str());
-                        /* Get the system properties. */
-                        SystemProperties *pSysProps = mVirtualBox->getSystemProperties();
-                        ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszExt[1]);
-                        if (trgFormat.isNull())
-                        {
-                            ++oit;
-                            continue;
-                        }
-                    }
-
                     // availableImage contains the disk identifier (e.g. "vmdisk1"), which should exist
                     // in the virtual system's disks map under that ID and also in the global images map
@@ -3258,5 +3232,4 @@
                 else
                 {
-                    fFoundInCurrentPosition = true;
                     ++oit;
                 }
@@ -3271,17 +3244,5 @@
         {
             /* just continue with normal files*/
-            fFoundInCurrentPosition = true;
             ++oit;
-        }
-
-        /* It means that we possibly have imported the storage earlier on the previous loop steps*/
-        if (!fFoundInCurrentPosition)
-        {
-            std::set<RTCString>::const_iterator h = disksResolvedNames.find(diCurrent.strHref);
-            if (h != disksResolvedNames.end())
-            {
-                /* Yes, disk name was found, we can skip it*/
-                continue;
-            }
         }
 
