WordPress Importer Tries to save media files to wrong site folder

I’ve created a patch that will work around this issue. This patch is for WordPress 3.6.1. It is a hack, not something that should be taken very seriously except that it points out where the problem may be. I don’t know PHP, but was able to trace it back to this point before giving up. I expect someone with more familiarity with the WordPress code base could figure out what the problem is once they see the patch and see what code is being modified.

I did notice that the code is doing a lot of checks against the IP of the remote server. I’m not sure the justification for checking whether the remote server is on a private network, but that may be part of the issue. The server we exported from is on 10.10.2.16, while the server we import on is 10.10.1.206. Both are on the same private network.

The patch is available here: http://pastebin.com/LeVtWKhX