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

Filenames with commas break entity display #1366

Closed
alxp opened this issue Nov 22, 2019 · 4 comments
Closed

Filenames with commas break entity display #1366

alxp opened this issue Nov 22, 2019 · 4 comments
Milestone

Comments

@alxp
Copy link
Contributor

alxp commented Nov 22, 2019

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.

@seth-shaw-unlv
Copy link
Contributor

Tagging related issue #1309.

@alxp
Copy link
Contributor Author

alxp commented Nov 23, 2019

The Psr7::parse_header() function is splitting the string over the comma characters. It seems like filenames should be uURL-encoded when they are sent to and from Gemini - if not having it fully encoded going in to Fedora.

@dannylamb dannylamb added this to the 1.1.0 milestone Jan 29, 2020
@dannylamb
Copy link
Contributor

This module takes care of it by sanitizing filenames as they come in: https://www.drupal.org/project/transliterate_filenames

I've tested it and it works for this and #1309

@dannylamb
Copy link
Contributor

Resolved via Islandora-Devops/islandora-playbook@d4c4167

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