Ok So I am trying to import nodes with remote file export method but somehow URLS in var export are not correct. This is what it looks like

Could not open 'http://croaziadentisti.it/public%3A//zub1.png' for reading.

seems like "files" directrory variables is not passed like it should be and instead some "public%3A/" token is here and ofcourse it doesn't work then. Any ideas why this is so?



This is export data excerpt

            'filename' => 'dentivo.jpg',
            'uri' => 'public://dentivo.jpg',
            'filemime' => 'image/jpeg',

and file_default_scheme() function also gives public:/ if checked in node_export.module around

              // Remote export mode
              elseif ($export_mode == 'remote') {
                $export_data = url($file->uri, array('absolute' => TRUE));
dpm(file_default_scheme() . ':/'  );

I checked this at two locations one is the drupal ugprade from 6 to 7, other is a multisite setting, both drupal sites work fine but are a bit complex.

Anyway. What I did is a hack to fix this as I counldn't locate where does problem come from. I rewrote how file path is constructed with one line and it works now.

              // Remote export mode
              elseif ($export_mode == 'remote') {
$file->uri = 'sites/default/files/'. $file->filename;
                $export_data = url($file->uri, array('absolute' => TRUE))

So maybe this could help someone. Also suggestion to module maintainter to add a "default" variable for path when exporting, this could solve possible cases like this if someone else has the same problem. But then again maybe it is a bug for everyone :-)

Thanks, it works for me, and I found a better way

// Remote export mode
              elseif ($export_mode == 'remote') {
                $file_public_path = variable_get('file_public_path', conf_path() . '/files');
                $file->uri = str_replace('public://', $file_public_path."/", $file->uri);
                $export_data = url($file->uri, array('absolute' => TRUE));

It is better when using multisite. :)

I preferred to do it this way as its much cleaner and does the same job:

elseif ($export_mode == 'remote') {
$export_data = file_create_url($file->uri);

Also this is a bug as the url will always have public:// stream and the url method doesn't handle this type of url.

#4 worked for me, and IMO is the most correct way to do it. I'm attaching a patch against 7.x-3.0.

For those using the Drush command to export their nodes as I am, I also found that you need to use the --uri command line param to have the correct URL generated for the remote file export method, eg:

drush --uri=http://example.com node-export-export --file=my_node_export.txt --format=drupal --type=article

Status:Active» Needs review

Issue summary:View changes
Status:Needs review» Reviewed & tested by the community

This works like a charm: must be released.

This seem to work, even on multisite, good job.