In the course of extending BasesfMediaLibraryActions I came across an issue.
Im not sure if its supposed to do this or how exactly its succeeding if its
not.

In the executeDelete action we see this:

$currentDir = $this->dot2slash($this->getRequestParameter('current_path'));
    $currentFile = $this->getRequestParameter('name');
$absCurrentFile = 
sfConfig::get('sf_upload_dir').'/assets/'.$currentDir.'/'.$currentFile;

so if a req. is curren_path=somedir&name=filename

we get
$currentDir = 'somedir';
$currentFile = 'filename;
$absCurrentFile = "$sf_upload_dir/assets/somedir/filename";

However executeIndex is responsible for setting a hidden form input for
current_path which it grabs from the request parameter 'dir'. So if the
request is: backend_dev.php/sfMediaLibrary there is no 'dir' parameter, or
rather it is ''.  so we get an incorrect path like so:

$currentDir = ''
$currentFile = 'filename';
$absCurrentFile = "$sf_upload_dir/assets//filename";

This matters to me because im trying to delete the record from the db based
on the file_path column which  is the absolute file system path to the file
in question. For some reason this code works despite the extra slash in the
path. Im not sure why... I didn't see operations removing this slash or
anything. I do know that modifying executeDelete so that:

$absCurrentFile = sfConfig::get('sf_upload_dir').'/assets/'.($currentDir ?
$currentDir.'/' : $currentDir).$currentFile;

has seemed to solve the issue for me. But id like to know what im missing
that allows this to work on an executeDelete in a stock sfMediaLibrary
install.

-- 
Ant Cunningham
Vector Based Design [ VECTR BAS-D ] | www.vectrbas-d.com
[EMAIL PROTECTED]





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to