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

Details text field convert to HTML #4001

Closed
Tracked by #66
jolevesq opened this issue Sep 27, 2021 · 6 comments
Closed
Tracked by #66

Details text field convert to HTML #4001

jolevesq opened this issue Sep 27, 2021 · 6 comments
Assignees
Labels
bug-type: confusing for: FGP For issues that are in support of the Federal Geospatial Platform problem: bug

Comments

@jolevesq
Copy link
Contributor

jolevesq commented Sep 27, 2021

When we click on this point (OBJECTID = 228), inside the description field there a piece of text:

This crossing is to be reconstructed using a three pole structure consisting of 50' class 1 poles within the Lumsden Pond Provincial Park P.Id. No. 55198360, spanning the watercourse a distance of 121.7m with three 336acsr conductors, to a two pole structure consisting of two 60' poles on NSPI lands P.Id. No. 55489553.

P.Id. in convert to an hyperlink when it should not. It links to a blank page. It is confusing for the user. In fact, p.id is a real website and even Jira automatically create an hyperlink from it. If it is done automatically in RAMP, can we have a black list inside the configuration to remove parsing from some piece of text?

https://maps-stage.services.geo.ca/server_serveur/rest/services/NRCan/TC_Assessments_EN/MapServer/0

@jolevesq jolevesq added bug-type: confusing for: FGP For issues that are in support of the Federal Geospatial Platform problem: bug labels Sep 27, 2021
@james-rae
Copy link
Member

Weird one. Verified the service is just plain text p.id. Something in the angular parser is interpreting that as a html hyperlink, which is silly. Maybe it thinks it's an id tag of a <p> element?

Will need someone who knows angular to take a look. My best guess is this line is the source of the auto-formatting but that's not helpful as autolink is stock angular I believe.

First approach should be to see if the formatter/filter can be smartened up to ignore dumb stuff like p.id.
Second approach will be to think of something better than my third approach.
Third approach is add a flag in config to suppress any html-ification of text in the details. Not sure best spot, boolean on columnNode?. This seems way overkill for one instance and a weird error at that.

@james-rae
Copy link
Member

For anyone looking to recreate, I find this layer behaves much better as Dynamic. Put in Lumsden Dam in the geosearch to zoom to the point in question.

@spencerwahl
Copy link
Member

autolink seems to be custom in this file.

linkifyjs (what the formatter uses) does seem to think p.id is a good thing to make a link. I believe the formatter just takes a chunk of html from tag to tag and runs it through linkify and anything linkify thinks is a link gets changed.

James' first approach should be doable by adding a validate function. But we should be sure that we won't be breaking anything for other people. The simplest would be checking if the string starts with www. but that would then make google.com not link.

@jolevesq jolevesq moved this from Follow Up to Not Viewer Related in FGP Visualization Requirements (Redmine) Nov 2, 2021
@jolevesq
Copy link
Contributor Author

@dan-bowerman Will this be part of the next release?

@RyanCoulsonCA
Copy link
Contributor

Hmm yeah, I'm pretty sure linkifyjs turns this into a URL because .id is a valid top-level domain. I could add a validator to check for http/https or www. but like Spencer said, I'm not certain that it wouldn't break something for someone.

A valid domain name must be at minimum 2 characters long, so if this is a one-off sort of issue, we could just add a validator that makes sure the "domain name" is at least 2 characters long before turning it into a link. This would make p.id not link, but something like hi.id would.

@dan-bowerman
Copy link
Member

Here is the production link (we cannot resolve the staging link in OP): https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/TC_Assessments_EN/MapServer/0

FGP Visualization Requirements (Redmine) automation moved this from Not Viewer Related to Done Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-type: confusing for: FGP For issues that are in support of the Federal Geospatial Platform problem: bug
Development

No branches or pull requests

5 participants