Skip to content

Filenames with commas break entity display #1366

@alxp

Description

@alxp

Steps to Reproduce

  1. Navigate to a node of an Islandora object
  2. Go to the Media tab and click Add Media
  3. Find a file to upload, but before uploading, put a comma in the file name somewhere. E.g. "Test,file.txt"
  4. Save the new media
  5. Go back to the media list page and click on the media to display the entity.

Expected Behaviour

You see the entity

Actual Behaviour

Page shows "The website encountered an unexpected error. Please try again later."

Apache Error Log shows:

[Thu Nov 21 05:56:27.085262 2019] [php7:notice] [pid 338] [client 10.0.2.2:50942] Uncaught PHP Exception InvalidArgumentException: "The URI '2019-Twillingate.wav/fcr:metadata' is invalid. You must use a valid URI scheme." at /var/www/html/drupal/web/core/lib/Drupal/Core/Url.php line 281, referer: http://localhost:8000/node/1/media

It looks like the problem is in the GeminiLookup::lookup() function here:

      $links = Psr7\parse_header($head->getHeader("Link"));
      foreach ($links as $link) {
        if ($link['rel'] == 'describedby') {
          return trim($link[0], '<>');
        }
      }

Where the PSR7 url function is breaking apart the URL where the comma is, and the return statement is only returning second part of the URL after the comma, where the first part contains the rest of the Gemini URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions