Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When forwarding emails, attachments are not included #4220

Closed
jdevalk opened this issue Sep 9, 2024 · 13 comments
Closed

When forwarding emails, attachments are not included #4220

jdevalk opened this issue Sep 9, 2024 · 13 comments

Comments

@jdevalk
Copy link

jdevalk commented Sep 9, 2024

When I forward messages to another email address, the attachments are not included in the forwarded message. Am I doing something wrong? Is this a setting?

PHP version: 8.2.23
FreeScout version: 1.8.152
Database: MySQL
Are you using CloudFlare: Yes
Are you using non-official modules: Yes

@freescout-help
Copy link
Collaborator

Are you sure you are using the latest FreeScout version?
Check errors in the browser console.

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

Well it's not showing me any updates?

I'm seeing the following error in the app logs:

Path cannot be empty {"userId":1,"email":"joost@<redacted>","exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Path cannot be empty at /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:207)

@freescout-help
Copy link
Collaborator

What is your OS? Are you able to attach files?

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

I'm on Linux.

Yes I'm able to attach files; this doesn't happen consistently for all messages either it seems, only for messages with multiple attachments.

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

What would you like to know? It seems to be adjusting the variables correctly.

The error has the following stacktrace:

[stacktrace]
#0 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(207): fopen()
#1 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Http/UploadedFile.php(84): Illuminate\Filesystem\FilesystemAdapter->putFileAs()
#2 /var/www/<redacted>/app/Attachment.php(155): Illuminate\Http\UploadedFile->storeAs()
#3 /var/www/<redacted>/app/Attachment.php(443): App\Attachment::saveFileToDisk()
#4 /var/www/<redacted>/app/Http/Controllers/ConversationsController.php(1754): App\Attachment->duplicate()
#5 [internal function]: App\Http\Controllers\ConversationsController->ajax()
#6 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array()
#7 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction()
#8 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Route.php(211): Illuminate\Routing\ControllerDispatcher->dispatch()
#9 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\Routing\Route->runController()
#10 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\Routing\Route->run()
#11 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#12 /var/www/<redacted>/app/Http/Middleware/CustomHandle.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#13 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\CustomHandle->handle()
#14 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /var/www/<redacted>/app/Http/Middleware/FrameGuard.php(14): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#16 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\FrameGuard->handle()
#17 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#18 /var/www/<redacted>/app/Http/Middleware/LogoutIfDeleted.php(28): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#19 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\LogoutIfDeleted->handle()
#20 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#21 /var/www/<redacted>/app/Http/Middleware/Localize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#22 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\Localize->handle()
#23 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /var/www/<redacted>/app/Http/Middleware/HttpsRedirect.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#25 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\HttpsRedirect->handle()
#26 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#27 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#28 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle()
#29 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#30 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(45): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#31 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Auth\Middleware\Authenticate->handle()
#32 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#33 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(67): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#34 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle()
#35 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#37 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#38 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#39 /var/www/<redacted>/app/Http/Middleware/TokenAuth.php(32): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#40 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\TokenAuth->handle()
#41 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#42 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#43 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle()
#44 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#45 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#46 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#47 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#48 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(61): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#49 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#50 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#51 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#52 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\Pipeline\Pipeline->then()
#53 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRouteWithinStack()
#54 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\Routing\Router->runRoute()
#55 /var/www/<redacted>/overrides/laravel/framework/src/Illuminate/Routing/Router.php(590): Illuminate\Routing\Router->dispatchToRoute()
#56 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch()
#57 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#58 /var/www/<redacted>/app/Http/Middleware/TerminateHandler.php(12): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#59 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\TerminateHandler->handle()
#60 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#61 /var/www/<redacted>/app/Http/Middleware/ResponseHeaders.php(11): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#62 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Http\Middleware\ResponseHeaders->handle()
#63 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#64 /var/www/<redacted>/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#65 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\Proxy\TrustProxies->handle()
#66 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#67 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#68 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#69 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#70 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#71 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#72 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#73 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#74 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#75 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#76 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#77 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle()
#78 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#79 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}()
#80 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then()
#81 /var/www/<redacted>/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#82 /var/www/<redacted>/public/index.php(82): Illuminate\Foundation\Http\Kernel->handle()
#83 {main}
"}

@freescout-help
Copy link
Collaborator

Add the following debugging code before this line https://github.com/freescout-help-desk/freescout/blob/dist/app/Attachment.php#L155

\Log::error("file_dir=".$file_dir.", file_name=".$file_name);

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

file_dir=1/0/1/, file_name=7212110-00048.pdf

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

Ok this is extremely weird. I was debugging deeper.

I added:

\Log::error("path=".$path.", name=".$name.", options=".$options);

before:

$options = $this->parseOptions($options);

in vendor/laravel/framework/src/Illuminate/Http/Uploadedfile.php

And suddenly, the error goes away and forwarding properly adds the attachments.

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

The fact that DISK = 'private'; seems to create the issue.

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

It breaks on the second pass of

$attachment_copy = $attachment->duplicate();

@jdevalk
Copy link
Author

jdevalk commented Sep 9, 2024

Continuing. It dies in the second time this gets called:

$result = Container::getInstance()->make(FilesystemFactory::class)->disk($disk)->putFileAs(
            $path, $this, $name, $options
        );

@freescout-help
Copy link
Collaborator

Let us know if you'll find out the reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants