8000 Incorrect field when ampersand in URL by albert-github · Pull Request #11404 · doxygen/doxygen · GitHub
[go: up one dir, main page]

Skip to content

Incorrect field when ampersand in URL #11404

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

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

albert-github
Copy link
Collaborator

When having an ampersand in an URL like:

https://en.wikipedia.org/w/index.php?title=Unsharp_masking&oldid=750486803#Photographic_unsharp_masking

this can lead to a warning in the xmllint checker like:

html\md_aa.html:108: parser error : EntityRef: expecting ';'
ck"><p><a href="https://en.wikipedia.org/w/index.php?title=Unsharp_masking&oldid
                                                                               ^

Note in e.g. the xml and docbook format there were already twice the filter call.

Example: example.tar.gz

(Found in the ITK package)

When having an ampersand in an URL like:
```
https://en.wikipedia.org/w/index.php?title=Unsharp_masking&oldid=750486803#Photographic_unsharp_masking
```
this can lead to a warning in the xmllint checker like:
```
html\md_aa.html:108: parser error : EntityRef: expecting ';'
ck"><p><a href="https://en.wikipedia.org/w/index.php?title=Unsharp_masking&oldid
                                                                               ^
```

Note in e.g. the xml and docbook format there were already twice the filter call.
@albert-github albert-github added bug HTML HTML / XHTML output labels Feb 7, 2025
@@ -401,7 +401,8 @@ void HtmlDocVisitor::operator()(const DocURL &u)
else // web address
{
m_t << "<a href=\"";
m_t << u.url() << "\">";
filter(u.url());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The url needs URL encoding inside the href and HTML encoding outside, see https://stackoverflow.com/a/1812486/784672. Probably also holds for XML and docbook.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks indeed the case that is required for all formats that potentially use the string to start a HTML browser, so probably not only XML and Docbook but also LaTeX, RTF, ...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I tried URL encoding, but then & is not escaped, so it still doesn't pass XML/XHTML checks. So I think your fix is correct as it is.

@doxygen doxygen merged commit bc8099c into doxygen:master Feb 14, 2025
10 checks passed
@albert-github albert-github added the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label Feb 15, 2025
@albert-github albert-github deleted the feature/bug_ampersand_url branch February 15, 2025 07:49
@doxygen doxygen removed the fixed but not released Bug is fixed in github, but still needs to make its way to an official release label May 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug HTML HTML / XHTML output
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0