Closed (fixed)
Project:
Video
Version:
6.x-5.0
Component:
Amazon S3
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Mar 2012 at 15:57 UTC
Updated:
25 Apr 2012 at 17:40 UTC
Jump to comment: Most recent file
After an update form a previous version of video module, and installation of all the newly-required dependencies and libraries, it appeared, that the S3 component stopped pointing to Amazon S3 bucket. I have debugged some of the code, and it appears, that on the File System level, the module gets the paths in the bucket correctly. However, somewhere in the process, it spits out the server URL rather than the S3. Can you please point me o the parts of the code, where the logic of choosing local server might me happening? I promise to post my results.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | capture-041.png | 46.17 KB | alexrayu |
Comments
Comment #1
Jorrit commentedThe substitution of the local path to the S3 path happens in plugins/video_s3/filesystem/video_s3.inc in the
load_file()method, line 34. Are you using Zencoder?Comment #2
alexrayu commentedThanks for a swift response. We are using Zencoder.
Comment #3
alexrayu commenteddpm($this->s3->get($video->fid)) returns:
And dpm($transcoder); returns
In video_s3.inc in public function load_file(stdClass $video);
Comment #4
alexrayu commentedIn public function load_file(stdClass $video) there is a line:
What that line does - it unconditionally assigns a local file path to URL, even though $file->url already contains the right S3 url.
I fixed my case by assigning filepath only if no S3 url exists:
Am I right or am I "short-circuiting" it?
Comment #5
Jorrit commentedI don't understand your comment.
getVideoUrlshould return an URL. The method is there because for authenticated URLs, the URL can't be stored in the database and has to be created when the URL is displayed.What is the return value of $this->s3->getVideoUrl($file->filepath) ? What is the value of $file->filepath?
If you change
if (strpos('/', $amazon->filename) !== FALSE && $transcoder == 'video_localcommand') {toif (strpos('/', $amazon->filename) !== FALSE) {and make no other changes compared to the release version, is it working?Comment #6
alexrayu commentedPlease see below.
Comment #7
alexrayu commentedThis is what I get.
In the $video object, there are two paths that I see for extension "mov";
1. $video->files->mov->filepath is pointing to the file path on the local system.
2. $video->files->mov->url is pointing to the S3 URL that we need to use.
An then in the code below, what happens, is that getVideoUrl() function gets the URL from the local filepath, no the S3 URL.
So, even when there is an S3 url present, it returns a local filepath invariably. It may be, that the update did not go well. Is this making any sense? Should I provide more info?
Comment #8
Jorrit commentedIs that screenshot taken from a dpm() call after or before
$file->url = $this->s3->getVideoUrl($file->filepath);?I think I have found the problem and I would be very glad if you could try the following:
1. Change the file back to its original form.
2. On line 38 and 39 of video_s3.inc change
$amazonto$file.3. On line 38, remove
&& $transcoder == 'video_localcommand'.The method now looks like:
I know that ->url is already present at the start of the method. This is left over from previous versions of the module where the Amazon S3 URL was permanently stored in the database. This has been changed in 4.5, however, because when authenticated URLs are used, the URL must be generated dynamically.
Comment #9
Jorrit commentedI change the title back to a more descriptive one.
I have one more question. Does the original bug also occur for files that have been uploaded after you upgraded?
Comment #10
Jorrit commentedUnfortunately, you have not responded to my questions. I am convinced that my fix works and I have committed it to 6.x-5.x and 6.x-4.x. Please reopen this issue if the fix doesn't work for you.
Comment #12
alexrayu commentedThank you for your fix Jorrit. Sadly, the project got wrapped before I could do additional testing. But I am glad you were able to see the issue and apply the changes.