Skip to content

Error when exporting single part with "%" in its name #1231

@scavislayvi

Description

@scavislayvi

Describe the bug
When exporting a single part (to any format), if the parts name contains a percentage sign, an error page is shown (Internal Server Error 500).

To Reproduce
Steps to reproduce the behavior:

  1. Create a part with a percent sign in its name (i.e. "Resistor 51 Ω 1% 0.25 W")
  2. Select only the created part in the overview
  3. Select "Export to [any format]" and click "Submit"

Expected behavior
I would expect a file to be downloaded, possibly with the percent sign replaced with another character if it would cause problems otherwise.

Server Side

  • Part-DB Version: 2.6.0
  • PHP Version: 8.4.17
  • Database Server: MariaDB 11.8.5

Desktop (please complete the following information):

  • OS: Linux Mint 22.2
  • Browser: Firefox 147.0.2

Additional context
Logs:

partdb  | [2026-02-07T23:33:56.971762+00:00] request.CRITICAL: Uncaught PHP Exception InvalidArgumentException: "The filename fallback cannot contain the "%" character." at HeaderUtils.php line 182 {"exception":"[object] (InvalidArgumentException(code: 0): The filename fallback cannot contain the \"%\" character. at /var/www/html/vendor/symfony/http-foundation/HeaderUtils.php:182)
partdb  | [stacktrace]
partdb  | #0 /var/www/html/vendor/symfony/http-foundation/ResponseHeaderBag.php(234): Symfony\\Component\\HttpFoundation\\HeaderUtils::makeDisposition()
partdb  | #1 /var/www/html/src/Services/ImportExportSystem/EntityExporter.php(269): Symfony\\Component\\HttpFoundation\\ResponseHeaderBag->makeDisposition()
partdb  | #2 /var/www/html/src/Controller/PartImportExportController.php(125): App\\Services\\ImportExportSystem\\EntityExporter->exportEntityFromRequest()
partdb  | #3 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(183): App\\Controller\\PartImportExportController->exportParts()
partdb  | #4 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
partdb  | #5 /var/www/html/vendor/symfony/http-kernel/Kernel.php(193): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
partdb  | #6 /var/www/html/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\\Component\\HttpKernel\\Kernel->handle()
partdb  | #7 /var/www/html/vendor/autoload_runtime.php(32): Symfony\\Component\\Runtime\\Runner\\Symfony\\HttpKernelRunner->run()
partdb  | #8 /var/www/html/public/index.php(5): require_once('...')
partdb  | #9 {main}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions