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

UHF-10404: Better map embed error handling #813

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

juho-lehmonen
Copy link
Contributor

@juho-lehmonen juho-lehmonen commented Sep 18, 2024

UHF-10404

What was done

Better error handling for map embeds so malformed URLs added via the Media Library form don't break everything.

The actual root cause will be handled in another ticket: https://helsinkisolutionoffice.atlassian.net/browse/UHF-10653

Replicate issue locally

  • Make sure your instance is up and running on latest dev branch.
    • git pull origin dev
    • make fresh
  • If you have the SOTE test dump from between 9.8 - 12.9 you might have one of these broken entities already. Go to /admin/content/media-grid and see if you get a fatal error. Otherwise, follow the steps below.
  • Add a new page or landing page
    • Add a "Map embed / Karttaupotus" component
    • In the media library view, insert https://www.hel.fi/fi as the URL, then click "Add" and "Save"
    • The media library popup will probably just reload, so close it
    • Now when you click "Add media" to open the media library it will fail and print errors in the JS console
    • Go to /admin/content/media-grid. This should result in a fatal error.

How to install

  • Update the Helfi Platform config
    • composer require drupal/helfi_platform_config:dev-UHF-10404-map-url-validation
  • Run make drush-cr

How to test

  • Reload the media library page. It should work now
  • Reload the page / landing page edit form and try adding a map embed. The media library should open normally now
  • Do the same with other media entities that can be added through the media library. Nothing should cause a fatal error on the edit form or media library popup.
  • Add a map media entity with a broken URL to a node, then view it.
    • This should cause a fatal error when viewing the node.
    • Update HDBT: composer require drupal/hdbt:dev-UHF-10404-map-url-validation then run drush cr
    • Reload the page. It should print an empty paragraph instead of throwing a fatal error
  • Check that code follows our standards

Continuous documentation

  • This change doesn't require updates to the documentation

Other PRs

Copy link

sonarcloud bot commented Sep 18, 2024

@juho-lehmonen juho-lehmonen changed the title Draft: UHF-10404: Better map embed error handling UHF-10404: Better map embed error handling Sep 19, 2024
@juho-lehmonen juho-lehmonen marked this pull request as ready for review September 19, 2024 06:13
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

Successfully merging this pull request may close these issues.

2 participants