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

Content translation breaks derivatives #985

Closed
dannylamb opened this issue Dec 4, 2018 · 9 comments
Closed

Content translation breaks derivatives #985

dannylamb opened this issue Dec 4, 2018 · 9 comments
Milestone

Comments

@dannylamb
Copy link
Contributor

Reported by @kanasznagyzoltan

Part of #939

After enabling content translation and the hungarian language, the language is being added to the url for files, which are unresolvable. E.g. http://localhost:8000/_flysystem/fedora/2018-12/image.png is getting written out as http://localhost:8000/hu/_flysystem/fedora/2018-12/image.png, which does not exist. This bogus url is getting onto the queue and being used as the Apix-Ldp-Resource header in derivative calls, and things are failing.

We generate the url here: https://github.com/Islandora-CLAW/islandora/blob/8.x-1.x/src/EventGenerator/EventGenerator.php#L25. Should be pretty easy to isolate and change or way of making that url.

@Natkeeran
Copy link
Contributor

@dannylamb

I reviewed this ticket. Need clarification with respect to the right/expected behaviour.

For nodes, the user has the option to specify the language (example English or Hungarian) when creating the node. However, for media, that option does not exist. Should it exist? I assume it should exist since media can be translated.

If media can be translated, then if the user in a specific language node (i.e http://localhost:8000/hu/node/1), then when the user clicks to add media, should the media node that language? This question can be resolved by adding the language field to the media.

If the language field exists, then that can help us specifying the right url.

@dannylamb
Copy link
Contributor Author

@kanasznagyzoltan Does adding the language field and setting it to Hungarian on the media work for you?

@whikloj whikloj changed the title Conent translation breaks derivatives Content translation breaks derivatives Jan 16, 2019
@DonRichards
Copy link
Member

I'm guessing but json_encode($event, JSON_UNESCAPED_UNICODE) on EventGenerator.php#L102 and see what happens.

@Natkeeran
Copy link
Contributor

Natkeeran commented Jan 25, 2019

Additional Notes:

Flysystem is building the url that get used by the EventGenerator. It is being created here:
https://github.com/twistor/drupal_flysystem/blob/8.x-1.x/src/Plugin/FlysystemUrlTrait.php#L35

path: 2019-01/Common_Wombat_43.jpg
schema: fedora

Thus, the following drupal uri fedora://2019-01/Common_Wombat_43.jpg gets converted into http://localhost:8000/ta/_flysystem/fedora/2019-01/Common_Wombat_43.jpg url.

flysystem.serve is defined here: https://github.com/twistor/drupal_flysystem/blob/8.x-1.x/flysystem.routing.yml#L11

I am not sure how the host/server info is being appended:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Url.php/function/Url%3A%3AfromRoute/8.6.x

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Routing%21UrlGenerator.php/8.6.x

    // Outbound path processors might need the route object for the path, e.g.
    // to get the path pattern.
    $options['route'] = $route;
    if ($options['path_processing']) {
      $path = $this
        ->processPath($path, $options, $generated_url);
    }

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21PathProcessor%21PathProcessorManager.php/8.6.x

  /**
   * {@inheritdoc}
   */
  public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
    $processors = $this
      ->getOutbound();
    foreach ($processors as $processor) {
      $path = $processor
        ->processOutbound($path, $options, $request, $bubbleable_metadata);
    }
    return $path;
  }

This seems to be going into the language module.

@whikloj whikloj added this to the 1.0.0 milestone Apr 11, 2019
@rangel35
Copy link

rangel35 commented May 15, 2019

I had this same issue happen, I solved it by editing the configuration
Administration->Configuration->Regional and language->Languages->Detection and selection

and enabled session instead of url (domain), and it just adds a suffix ?lang=es

lang can be language, you configure and choose the argument yourself

@dannylamb
Copy link
Contributor Author

@kanasznagyzoltan @Natkeeran ^^

Would that work for you?

@rangel35
Copy link

deleted earlier comment about intermittent issues...that was strictly a permissions thing on our end so back to that works for me :)

@Natkeeran
Copy link
Contributor

Natkeeran commented May 17, 2019

@dannylamb

The workaround does address the issue somewhat. However, that won't be an appropriate solution for many use cases.

"Language from the URL (Path prefix or domain)." is the default and one of the most common ways to determine language. If you don't have language prefix in the path, there is no way to get a specific language url of a node or content.

Islandora 8 is definitely breaking standard Drupal behaviour.

Not addressing the core issue can be problematic down the line as well.

@Natkeeran
Copy link
Contributor

Just want to highlight that the issue is related to the storage of Original Files, which get stored to Fedora. The service files, thumb nails etc that get stored to local file systems work fine.

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

5 participants