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

set_finder can output bad xml #21

Open
jesusbagpuss opened this issue Aug 29, 2022 · 0 comments
Open

set_finder can output bad xml #21

jesusbagpuss opened this issue Aug 29, 2022 · 0 comments
Milestone

Comments

@jesusbagpuss
Copy link

https://github.com/eprintsug/irstats2/blob/main/cgi/stats/set_finder#L86
The call to EPrints::Utils::url_escape doesn't encode &s - so if a set value has that character in it, it produces broken XML:

<li>
  <div class='irstats2_setfinder_row'>
    <a href='https://example.com/cgi/stats/report/institution/University%20of%20York%20&%20Aarhus%20University/'>University of York &amp; Aarhus University</a>
    <!--                                                                              ^^^ here         -->
  </div>
</li>

should be either &amp; or %26.
As the stats URL is a REST-like interface, the value is in a path (rather than query string).

I think the best fix would be to use URI::Escape and encode the value with uri_escape( $escape_value ).
That module is already used in other parts of EPrints. The escape_value may not be needed with this approach.

Other options (feel worse?) are:

  • HTML::Entities::encode( EPrints::Utils::url_escape( $escape_value ), '&') (feels messy)
  • HTML::Entities::encode( $escape_value ) (doesn't encode spaces)
@jesusbagpuss jesusbagpuss added this to the 1.2 milestone May 1, 2024
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

1 participant