blogotext icon indicating copy to clipboard operation
blogotext copied to clipboard

wrong URL at file upload

Open B4rb3rouss opened this issue 6 years ago • 7 comments

When you upload a file, the URL proposed integration code is wrong.

  • Upload file.odt
  • The url shown is [url]/Blog/files/3e/file.odt[/url]. It's wrong
  • The file is infact located at /Blog/files/file.odt

It seems to be a mistake in db register.

This only affects files, not images.

B4rb3rouss avatar Sep 21 '17 05:09 B4rb3rouss

Hum ... I run some test with differents files (.odt) on my side, nothing. This is just for 1 file or all file ?

From what I see, the file type (image, document ...) is based on the extension of the file. Depends on the file type, the file path use URL_IMAGES or URL_DOCUMENTS can you test this ?

var_dump(URL_DOCUMENTS);
var_dump(URL_IMAGES);

remrem avatar Sep 24 '17 21:09 remrem

It was with only one file, a .odt document. Where should I put this code?

B4rb3rouss avatar Sep 26 '17 16:09 B4rb3rouss

can you try to replace your admin/fichiers.php with this and take a look at your file (with URl like admin/fichiers.php?file_id={file ID}&edit)

remrem avatar Sep 28 '17 08:09 remrem

Thanks. Here is the return :

string(22) "File name : oukile.odt" string(20) "File extension : odt" string(34) "Type from function : text_document" string(28) "Type from db : text_document" string(18) "Is image ? : false" string(46) "URL_IMAGES : https://yeuxdelibad.net/Blog/img/" string(51) "URL_DOCUMENTS : https://yeuxdelibad.net/Blog/files/" string(23) "$myFile['bt_path'] : 3e" string(40) "$urlRelative : /Blog/files/3e/oukile.odt" string(63) "$urlAbsolute : https://yeuxdelibad.net/Blog/files/3e/oukile.odt"

The file is in /Blog/files/oukile.odt and not in /Blog/files/3e/oukile.odt

B4rb3rouss avatar Sep 30 '17 09:09 B4rb3rouss

From what I see (haven't take seriously an eye on the file upload process yet),
$myFile['bt_path'] seem's to be the problem.
I suppose, this var is set on file upload. BT try to guess the file type based on the file extension and, depends on the file type (image/doc) fill $myFile['bt_path'] with an empty or a subfolder name.

I try to take a look deeply in the file manager this W.E.

remrem avatar Sep 30 '17 09:09 remrem

'bt_path' => ((empty($path)) ? (substr($checksum, 0, 2)) : $path ), We should probably find a better way to generate links to patch it

extragornax avatar Oct 11 '17 10:10 extragornax

Can we push this issue to BT 3.8 ?

remrem avatar Oct 18 '17 15:10 remrem