Unable to import a file field to media

Created on 18 February 2024, 10 months ago

Hello and thanks for the module

Problem/Motivation

I have almost migrated a Drupal 7 site to Drupal 10.
I need to convert an old upload field to a Media field.
My files folder is in web and not under default.
I have in my setttings.php
$settings['file_public_path'] = 'files';
I don't change this old location because in the body field it has links and embedded images.
When I use your module to make the copy I get this error for all the files:

  [warning] sha1_file(): php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [warning] sha1_file(http://default/files/name.xls): Failed to open stream: php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [notice] Created file "name.xls, FID:92" in node "Test" from field "upload" to media field "upload_media".

I have commented the line but the ressult it is the same but

  [warning] sha1_file(): php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [warning] sha1_file(http://default/sites/default/files/name.xls): Failed to open stream: php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [notice] Created file "name.xls, FID:92" in node "Test" from field "upload" to media field "upload_media".

if I put the full url,
$settings['file_public_path'] = 'http://test.test/files/';
I also get the bad url:

  [warning] sha1_file(): php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [warning] sha1_file(http://default/http://test.test/files/name.xls): Failed to open stream: php_network_getaddresses: getaddrinfo for default failed: Name or service not known FileToMedia.php:210
 [notice] Created file "name.xls, FID:92" in node "Test" from field "upload" to media field "upload_media".

Steps to reproduce

  • Enable your module
  • Create media field to import files (multiple)
  • drush filefield-to-media:copy upload upload_media document field_media_document node

Thanks for any help and have a good day :)

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain candelas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024