I'm using D7 and the latest Feeds to pull videos from youtube. These videos are only embedded using the latest version of Oembed and I do not store them locally.

After I've read that the Media Asset field is being deprecated in favor of Drupal's File Field I decided to switch the field type I'm using to display these youtube videos from Multi Media Asset to File Field.

But now when I try to import a video the same way I did before (using an http crawler and xpath praser) I get this error code:

"Invaild Enclousre Error"

Checking the log messages for the error it seems that the server is trying to copy the file locally:

The specified file temporary://filC28B.tmp could not be copied to public://films/view_play_list?p=PLF66F466F51CCFAB4

After I've examined the "Media Asset Field"setup that I've used to pull and display embedded videos from 3rd parties
I'm not sure if this is a bug or perhaps there is a need for another module such as http://drupal.org/project/media_feeds to tell feeds importer not to try and download locally.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dman’s picture

This may be related to the extra characters in the filename that can't be saved safely on a local filesystem without tranliteration or something.

OTOH, I got this message for a different reason - I spotted an error in
FeedsParser.inc:FeedsEnclosure:getFile() which triggers if you've defined a subdirectory for your filefield.


        if(file_uri_target($destination)) {
          $destination .= trim($destination, '/') . '/';
        }

Should be


        if(file_uri_target($destination)) {
          $destination = trim($destination, '/') . '/';
        }

It was borking each of my imports, as one of the last thing I did after 3 days working on a perfect data import was to make sure that the files directory being used was a tidy one.
MAY not be the same issue for you, but it DID give me the errors

"Invalid enclosure http://example.com/getattachment/3f7abf83-9844-436f-b859-40ca5023bea2/Fi..."
"File temporary://fileO8bE2f could not be copied, because the destination directory public://imagespublic://images is not configured correctly."

dman’s picture

(I see the bug I found has been fixed in -dev)

dman’s picture

Please ignore, I'm just dropping this patch here as an interim measure for a makefile for a distro I'm building - don't want to rely on feeds -dev yet

mirzu’s picture

Status: Active » Reviewed & tested by the community

patch in #3 works for me.

twistor’s picture

Status: Reviewed & tested by the community » Active

As stated in #3, this was already fixed. The patch is there for posterity. The original issue is still active, however, I don't think there's any problem creating files with ?= in them. My thorough testing includes $ touch "view_play_list?p=PLF66F466F51CCFAB4".

MrPeanut’s picture

I'm not having this same exact problem, but it's related, so I'm hoping someone can help.

I had an embedded media field (all YouTube links) in Drupal 6. I'm trying to import those into Drupal 7 as a filefield. I thought I'd be able to just put the YouTube URL in my "video" field, but that doesn't seem to work. Do I have to use the Media Feeds module?

SilviaT’s picture

Same problem for me.
Patch #3 worked for me too.

roynilanjan’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha6

Can u please tell me when trying to apply in alpha version unable to apply patch

patch -p1 < /srv/www/236/feeds-bad_file_destination_for_enclosures-1482530.patch within feed directory,
gives

patching file plugins/FeedsParser.inc
Hunk #1 FAILED at 350.
1 out of 1 hunk FAILED -- saving rejects to file plugins/FeedsParser.inc.rej

or I should always go for dev version of feed module for this patch!

dman’s picture

If you are not able to patch, then yes - do just grab the -dev version where the fix is already available.
Or make the change described in #1 (which is all the patch does) by hand.

gtothab’s picture

I'm still having the problem described by the original post in this thread. I'm attempting to import a video URL string into a file field (with Media file selector widget type). The string is not getting populated into the field upon import and node creation.

Can anyone help with this?

Thanks!

Nehlatak’s picture

Same problem.

Nehlatak’s picture

I changed the 'Temporary directory' on this page - admin/config/media/file-system. It solved my problem.

SocialNicheGuru’s picture

Issue summary: View changes

the patch has already been included in latest dev

dexiecarla’s picture

Hello, does anyone still experience this error? I am using the latest version 7.x-2.0-alpha8, patch is already applied, yet im still encountering the error.

twistor’s picture

Status: Active » Closed (fixed)

This was fixed a long time ago. Sorry I never got around to closing it.

If you're seeing a similar issue in alpha8, then that's a different issue.

Try upgrading to alpha9.

twistor’s picture

Title: Importing an embed link to a File field type, without saving the file locally, yields an "Invalid Enclosure error" » Support remote files in file field.
Version: 7.x-2.0-alpha6 » 7.x-2.x-dev
Category: Bug report » Feature request
Status: Closed (fixed) » Active

Errr, no this wasn't fixed.

MegaChriz’s picture

MegaChriz’s picture

kenorb’s picture

I had similar problem:

notice feeds Invalid enclosure http://media.example.com/live/ShowImageXML.asp?SecId=x&Id=P2&ImgId=y&z=z...
error Feeds exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://images/ShowImageXML.asp' for key 'uri''

I'm using the latest dev.

I've tried to rename the file using hook_file_presave() as shown here, but this error is still there. I think the problem is that Feeds think of this URL as a "file" which repeats with the same name (ShowImageXML.asp), because the query is trimmer and ignored.

Finally solved by the patch from: #2611014: Feeds doesn't import remote images which have no proper extension (such as ASP)

tterranigma’s picture

Status: Active » Closed (duplicate)