Opened 11 years ago

Last modified 9 years ago

#9 new enhancement

feature request

Reported by: Laurent Haond Owned by: Benjamin Linet
Priority: major Component: Bearmail
Keywords: Cc:

Description

  • i added a function to change bearfile behaviour when file already exists to rename file instead of replacing it.
  • perhaps behaviour should be choosen via a config option or by user
  • see attached file

Attachments (2)

bearfile.php (4.0 KB) - added by Laurent Haond 11 years ago.
bearfile.patch (1.2 KB) - added by Benjamin Linet 9 years ago.

Download all attachments as: .zip

Change History (11)

Changed 11 years ago by Laurent Haond

Attachment: bearfile.php added

comment:1 Changed 11 years ago by Vincent Caron

Bearfile should be idiot-proof and updating a file without a single warning is not.

I'll take the patch, maybe tweak it a little for style. I like the fact that the file extension is preserved !

comment:2 Changed 11 years ago by zerodeux

Resolution: fixed
Status: newclosed

(In [455]) Add a version (-xx) instead of overwriting files. New version_max parameter defaults to 100. Thanks lhaond for patch idea - closes #9

Changed 9 years ago by Benjamin Linet

Attachment: bearfile.patch added

comment:3 Changed 9 years ago by Benjamin Linet

Resolution: fixed
Status: closedreopened

I've found some errors with bearfile:

  • if $folder has a dot in its name, bearfile try to rename it instead of the file name;
  • output error of the uploaded file (Could not write file, please contact your technical support) doesn't print the name of the file;
  • $name isn't renamed, and the web server return "Your file as been uploaded as '$name'.", same for the email;
  • The downloaded file (downloaded with the url in the email) is renamed with the full path "s%/%_/g"-like form in its name (ex: "_var_www_bearfile_dir_my-file.txt").

See the patch that fixes thoses "errors".

comment:4 Changed 9 years ago by Vincent Caron

Owner: changed from Vincent Caron to Benjamin Linet
Status: reopenednew

OK, got it.

The correct patch is to try to rename only $name, and not the whole $target path.

I also fixed missing escapes (and possible XSS) in somme error messages.

Could you try the new version ? ([663])

comment:5 Changed 9 years ago by Benjamin Linet

working, except the downloaded name file (full path"s%/%_%g"-like form)

comment:6 Changed 9 years ago by Vincent Caron

Can you be more explicit ? Give me an input file name, what's expected and what you got instead ? And specify which filename you're talking about (the one displayed on the web page and/or the one used while downloading).

comment:7 Changed 9 years ago by Benjamin Linet

You can share this file by giving this link:

  http://foo.domain.tld/395a1b9a/file-3.png

when we go to this url with a Web browser, the downloaded file name is _var_www_foo.domain.tld_file-3.png with firefox and /var/www/foo.domain.tld/file-3.png with webkit instead of file-3.png (like with wget).

comment:8 Changed 9 years ago by zerodeux

(In [664]) Download file name: use basename and not full path, see #9

comment:9 Changed 9 years ago by Vincent Caron

New fix in [664]. Works better now ?

Note: See TracTickets for help on using tickets.