After i moved some files from directory #1 to directory #2, i can't download them via filedepot (Page not found).
I think the files are not moving physically on the server, but in the database the datas of the files updated.

In the filedepot.class.php (line 673, function moveFile()) there's a query:

...
$query2 = db_query("SELECT fname FROM {filedepot_fileversions} WHERE fid=%d", $fid);
while ($A = db_fetch_array($query2)) {
$vname = stripslashes($A['vname']);
...

The $A['vname'] should be $A['fname'], or not?

Comments

blainelang’s picture

Assigned: Unassigned » blainelang
Status: Active » Needs review
StatusFileSize
new3.98 KB

Thanks and that's one I should have found much sooner ;)

I have added more error checking as well as fixing the underlying code issue that you pointed out.
Attached is a patch that updates filedepot.class.php, ajaxserver.php and js/common.js

ldav1s’s picture

I applied the patch and created two folders, 'test' and 'test2'. I uploaded a file into 'test' and moved it to 'test2'. I'm not getting a download from either the file popup or the
download Action in the file list. I'm not sure why the file popup download is not working. The cid and fid look good. The download Action is obviously wrong (the cid is wrong, but the fid is right).

ldav1s’s picture

I'm not so sure about that obviously wrong part now. I tried uploading another file into 'test2' and it had the "wrong" cid, but downloaded OK.

Interestingly, the first file I had moved into 'test2' vanished after uploading the second file into 'test2'. It seems to be gone from the file store (filedepot_private), too.

So a recap:

-- created folders 'test' and 'test2' at the top level
-- uploaded 'file1' into 'test'
-- moved 'file1' into 'test2'. It looks OK, but attempting to download the file gives me nothing (via dialog) or an Access Denied (403) via the Action.
-- uploaded 'file2' into 'test2'. The only file in 'test2's listing is now 'file2'. 'file1' is gone from filedepot_private, but is in the file listing for 'test'.
If you attempt to download 'file1' you get a Page not Found.

Additionally download seems broken from the file dialog after the patch. Non-moved files still download OK from the Action link.

ldav1s’s picture

I figured out what needs to happen additionally.

-- created folders 'test' and 'test2' at the top level
-- uploaded 'file1' into 'test'

So far so good.

-- moved 'file1' into 'test2'.

'file1' is there OK. What is not there is filedepot_private/<cid>/.htaccess. This file seems to get created when a file is uploaded to a folder.
I thought that this would fix the download problem, but it didn't.

ldav1s’s picture

StatusFileSize
new1.95 KB

I got the Download/Edit actions downloading with this combined patch. I kept getting 'File record not found' messages in the log from filedepot_download/<cid>/<fid>.

I'm still seeing these problems:

-- created folders 'test' and 'test2' at the top level
-- uploaded 'file1' into 'test'
-- moved 'file1' into 'test2'. It looks OK, but attempting to download the file gives me nothing (via dialog), but Downloads Action seems OK, and downloads a file for Edit Action.
-- uploaded 'file2' into 'test2'. The only file in 'test2's listing is now 'file2'. 'file1' is gone from filedepot_private.

blainelang’s picture

StatusFileSize
new2.68 KB

I was just finishing up a patch that fixes the issue with the move and download broke after the move. Needed to update the drupal files table. I've also added another layer of testing to verify the file was moved.

Just having an issue creating these patches -- as my development environment is windows and I use PhpED as my ID.

Here is the patch for filedepot.class.php

ldav1s’s picture

I unapplied my patch in comment #5, and applied the patch in comment #6. It's having the same issues in the short test described in comment #5.

blainelang’s picture

StatusFileSize
new19.48 KB

I suspect there is an issue in how my patches are being created as I am able to upload files and still download them them after the move to another folder - using the download action, download menu item or via the native drupal view content interface.

Attached is a zip file with the two changed files. If this works then I will just commit to CVS.

ldav1s’s picture

I copied ajaxserver.php and filedepot.class.php to the filedepot directory (there didn't seem to be any difference between these files and the patched versions, other than CRLF/LF differences).
I am able to download through the native drupal view content interface, the download action, but not the download menu item.

ldav1s’s picture

Sorry, I was wrong. I keep clicking on the "direct link to file" instead of the "Download link". Works.

blainelang’s picture

Thanks -- you had me questioning if I needed stronger coffee.

@@
<
\/

artam’s picture

I applied the patches on my site (i downloaded the zip file).
I uploaded a file (via the client) with another user(name), who has admin rights on filedepot (I'm the superuser/uid=1).

I (as superuser) moved the file into folder#1 from the incoming view (it works fine). After that i'm tried to move the file form folder#1 to folder#2. "Activity" message appears for a long time, but nothing else.

I think, the problem is in the filedepot.class.php (line 658, function moveFile), there's a function called "fm_getPermission", but it doesn't exist (imho).

...
if ($submitter == $user->uid OR fm_getPermission($newcid, 'admin')) {
...

I changed the "fm_getPermission" function to the "$this->checkPermission" method, and it seems ok (i think so).

...
if ($submitter == $user->uid OR $this->checkPermission($newcid, 'admin')) {
...
ldav1s’s picture

I've run into problems with fm_getPermission also, when I was trying a patch to move multiple directories. I made a similar patch IIRC. I don't know if it was correct, but at least it was better than "not defined".

blainelang’s picture

Thanks --- will get this in the next CVS update.

blainelang’s picture

Status: Needs review » Fixed
ldav1s’s picture

Fixed in 1.0-rc3.

Status: Fixed » Closed (fixed)

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

david1982’s picture

Version: 6.x-1.0-rc2 » 6.x-1.1
Issue tags: +filedepot-6.x-1.1

Hi,

I have moved my Drupal Site from one server to another.

Before, base settings for Filedepot was:
C:/xampp/htdocs/filedepot_private/
Now, in new server it is D:/Documents/

Unfortunately, I can not download previously upload files. (I can only download those files that have been uploaded at new server by using filedepot frontend )

However, if ( by using filedepot frontend ) I move files from one folder to another folder; then I am able to download the files.

Could anybody shed a light on this issue?

Kind Regards,
David