I am running a German localized version of drupal. When I tried to import files from the file system (additionally I did not find a link to the import, but entered the url /admin/content/media/import manually), in the last step/page of the import process, I got the following error message:
Notice: Undefined index: directory in media_import_validate() (line 484 of /var/www/drupal7/sites/all/modules/media/media.admin.inc).
Notice: Undefined index: pattern in media_import_validate() (line 485 of /var/www/drupal7/sites/all/modules/media/media.admin.inc).
The provided directory does not exist.

Additionally the import keeps locked in this stage, i.e. does not really import the files but "calls" the page again.

I got it working using the following fix: In media.admin.inc there are two functions, media_import_validate and media_import_submit which are responsible for handling these stages of the import. The first lines there are:
if ($form_state['values']['op'] == 'Confirm') {
and
if ($form_state['values']['op'] != 'Confirm') {
However, due to the localisation, I guess $form_state['values']['op'] contains not 'Confirm', but the translated version, t('Confirm'), e.g. "Bestätigen" in German. So I changed these lines to
if ($form_state['values']['op'] == t('Confirm')) {
and
if ($form_state['values']['op'] != t('Confirm')) {
and it works just fine.

Can anyone please check and confirm?

Comments

JacobSingh’s picture

Status: Active » Fixed

Thanks! Committed it.

tbh, the whole way that form is handled is kinda backwards, but this little fix at least eases the pain. Great to have non-english languages being used w/ Media. Please keep filing bugs. our l10n testing has been near zero thus far.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

alldirt’s picture

Title: Import from file system not working when using localized non-English version » upload / Import from file system not working when using localized non-English version
Version: 7.x-1.0-beta3 » 7.x-1.0-beta5
Status: Closed (fixed) » Active

This bug still persists in function "media_import_submit".
The proposed fix works for me.

tommychris’s picture

Status: Active » Reviewed & tested by the community

#3 writes the truth.

dave reid’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, fixed the untranslated string in media_import_submit() as well.
http://drupalcode.org/project/media.git/commit/bfe2054 (7.x-2.x)
http://drupalcode.org/project/media.git/commit/1915a9f (7.x-1.x)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.