PHP version: 8.3
FreeScout version: 1.8.145
Database: PostgreSQL
Are you using CloudFlare: No
Are you using non-official modules: No
On Windows attachments URL's shown in message body are malformed. Attachment's function getStorageFilePath returns string with backslashes, that are later escaped to %5C in url function. So final attachment URL contains %5C instead of forward slashes. That results in 404 when trying to view attachment.
URL should contain only forward slashes, so it is reasonable to replace DIRECTORY_SEPARATORS returned by getStorageFilePath with forward slashes.
I propose to rewrite Attachment's url() like this:
public function url()
{
$file_path = $this->getStorageFilePath();
// URL must contain only forward slashes.
$file_path = str_replace(DIRECTORY_SEPARATOR, '/', $file_path);
$file_url = Storage::url($file_path);
// Fix percents.
// https://github.com/freescout-helpdesk/freescout/issues/3530
$file_url = str_replace('%', '%25', $file_url);
return $file_url.'?id='.$this->id.'&token='.$this->getToken();
}
PHP version: 8.3 FreeScout version: 1.8.145 Database: PostgreSQL Are you using CloudFlare: No Are you using non-official modules: No
On Windows attachments URL's shown in message body are malformed.
Attachment
's functiongetStorageFilePath
returns string with backslashes, that are later escaped to%5C
inurl
function. So final attachment URL contains%5C
instead of forward slashes. That results in 404 when trying to view attachment.URL should contain only forward slashes, so it is reasonable to replace DIRECTORY_SEPARATORS returned by
getStorageFilePath
with forward slashes.I propose to rewrite
Attachment
'surl()
like this:I can file PR if it is OK.