Filebrowser: $FILE variable doesn't set properly "Before Delete"

Created on 1 Jan 2019  路  5Comments  路  Source: filebrowser/filebrowser

When did you download File Browser from caddyserver.com?
2018-12-31

What is your entire Caddyfile?

demo.com:443 {
  filemanager / /mnt/CloudDisk {
    database /etc/ssl/caddy/filemanager/database.db
    locale zh_cn
    allowCommands true
    allowEdit true
    allowNew true
  }
}

Description
A clear and concise description of what the issue is about. What are you trying to do?
I'm trying to implement a function like Rubbish Bin or Recently Delete, move the file to .trash folder instead of delete it directly.

Expected behaviour
What did you expect to happen?
File is moved to .trash folder.

What is happening instead?
Please, give full error messages and/or log.
My script is cp $FILE .Trash, and the file to be delete is named new, just right in the path /mnt/CloudDisk/
When I hit the delete button, server reported Internal Server Error
Here is the logs

Jan 01 15:51:18 caddy[14233]: 2019/01/01 15:51:18 [INFO] Blocking Command:"cp $FILE .Trash"
Jan 01 15:51:18 caddy[14233]: cp: cannot stat '$FILE': No such file or directory
Jan 01 15:51:18 caddy[14233]: 2019/01/01 15:51:18 /new: 500 Internal Server Error
Jan 01 15:51:18 caddy[14233]: 2019/01/01 15:51:18 exit status 1

And then I saw #483, so I changed my script to bash -c "cp $FILE .Trash" with no working:

Jan 01 15:58:24 caddy[14233]: 2019/01/01 15:58:24 [INFO] Blocking Command:"bash -c cp $FILE .Trash"
Jan 01 15:58:24 caddy[14233]: cp: cannot stat '/new': No such file or directory
Jan 01 15:58:24 caddy[14233]: 2019/01/01 15:58:24 /new: 500 Internal Server Error
Jan 01 15:58:24 caddy[14233]: 2019/01/01 15:58:24 exit status 1

I noticed the second line, said, "cannot stat '/new'", so for testing, I modified the script to

bash -c "echo file=$FILE"
bash -c "echo $PWD"
bash -c "cp $FILE /mnt/CloudDisk/.Trash"

the log now is

Jan 01 16:02:59 caddy[14233]: 2019/01/01 16:02:59 [INFO] Blocking Command:"bash -c echo file=$FILE"
Jan 01 16:02:59 caddy[14233]: file=/new
Jan 01 16:02:59 caddy[14233]: 2019/01/01 16:02:59 [INFO] Blocking Command:"bash -c echo $PWD"
Jan 01 16:02:59 caddy[14233]: /
Jan 01 16:02:59 caddy[14233]: 2019/01/01 16:02:59 [INFO] Blocking Command:"bash -c cp $FILE /mnt/CloudDisk/.Trash"
Jan 01 16:02:59 caddy[14233]: cp: cannot stat '/new': No such file or directory
Jan 01 16:02:59 caddy[14233]: 2019/01/01 16:02:59 /new: 500 Internal Server Error
Jan 01 16:02:59 caddy[14233]: 2019/01/01 16:02:59 exit status 1

Additional context
Add any other context about the problem here. If applicable, add screenshots to help explain your problem.

How to reproduce?
Tell us how to reproduce this issue. How can someone who is starting from scratch reproduce this behaviour as minimally as possible?

Files
A list of relevant files for this issue. Large files can be uploaded one-by-one or in a tarball/zipfile.

bug 馃悶

Most helpful comment

@the-eric-kwok no, it should be the absolute path. Thanks for reporting this! WIll be fixed on 2.0

All 5 comments

I changed my script to bash -c "mv /mnt/CloudDisk/$FILE /mnt/CloudDisk/.trash" and it works!

If this is a feature, I think we should at least mention it in the Document or in setting page. But not to let people guessing like how could I get it work!

@the-eric-kwok no, it should be the absolute path. Thanks for reporting this! WIll be fixed on 2.0

@hacdias Thank you 馃槝

When #575 is merged and released, this will be available!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eternaltyro picture eternaltyro  路  5Comments

GuyPaddock picture GuyPaddock  路  3Comments

2FA
francislavoie picture francislavoie  路  7Comments

quentin-rey picture quentin-rey  路  6Comments

aoceano picture aoceano  路  4Comments