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

Image descriptions in EXIF data with non ASCII characters is missing #8079

Closed
techxplorer opened this issue Dec 20, 2020 · 4 comments · Fixed by #8327
Closed

Image descriptions in EXIF data with non ASCII characters is missing #8079

techxplorer opened this issue Dec 20, 2020 · 4 comments · Fixed by #8327

Comments

@techxplorer
Copy link

techxplorer commented Dec 20, 2020

What version of Hugo are you using (hugo version)?

Hugo Static Site Generator v0.79.1/extended darwin/amd64 BuildDate: unknown
(Installed using homebrew)

Does this issue reproduce with the latest release?

Yes

Description

I'm using Hugo to build a photo gallery website, and using the data in the imagedescription tag in the EXIF data to display a description below the image. I have noticed that images with non ASCII characters in the field have this element missing in the EXIF object.

Steps to reproduce

Use the Exif.Tags.ImageDescription to display the image description in a template with a description like this:

Città del Vaticano #vatican #vaticancity

Observe that the Exif.Tags.ImageDescription variable is empty

Use the same template with an image description like this:

Citta del Vaticano #vatican #vaticancity

Observe that the Exif.Tags.ImageDescription variable contains the description from the image.

Other characters that I've seen that cause this issue are:

instead of " or instead of ' or any emoji character

Additional information

The EXIF tags are being written with version 12 of exiftool

@davidsneighbour
Copy link
Contributor

This might not be a bug, but security features (think of rm -rf in some shellcode). Please have a look at the safe functions in Hugo and if that is unrelated please show a specific layout/template where the procedure breaks:

@techxplorer
Copy link
Author

Hi @davidsneighbour

Thanks for the quick reply.

A minimal example of the template code that reproduces the issue is as follows:

{{ define "main" }}
  <section>
  {{ with .Resources.ByType "image" }}
    {{ range sort . "Name" "desc" }}
      {{ printf "%+v" .Exif.Tags}}
    {{ end }}
  {{end }}
  </section>
{{ end }}

This, combined with the two attached files, shows the error I'm seeing. The missing-image-description-tag.jpg file will render a list of tags with an empty ImageDescription element.

In contrast the has-image-description-tag.jpg file will render a list of tags that includes a value for the ImageDescription element.

The only difference, that I can see, is that the first file has a description that includes Città and the second has this replaced with Citta

@bep bep added this to the v0.80 milestone Dec 20, 2020
@bep bep modified the milestones: v0.80, v0.81 Jan 2, 2021
@bep bep modified the milestones: v0.81, v0.82 Feb 19, 2021
@techxplorer
Copy link
Author

techxplorer commented Mar 12, 2021

Hi @bep

I'm not a Go developer so I cannot investigate the code. Is there anything else that I can do to help investigating this issue?

moorereason added a commit to moorereason/hugo that referenced this issue Mar 13, 2021
The root cause of issue gohugoio#8079 was a non-breaking space (U+0160).
`unicode.IsPrint` only allows the ASCII space (U+0020).  Be more lenient
by using `unicode.IsGraphic` instead.

Fixes gohugoio#8079
moorereason added a commit to moorereason/hugo that referenced this issue Mar 13, 2021
The root cause of issue gohugoio#8079 was a non-breaking space (U+0160).
`unicode.IsPrint` only allows the ASCII space (U+0020).  Be more lenient
by using `unicode.IsGraphic` instead.

Fixes gohugoio#8079
@bep bep closed this as completed in #8327 Mar 13, 2021
bep pushed a commit that referenced this issue Mar 13, 2021
The root cause of issue #8079 was a non-breaking space (U+0160).
`unicode.IsPrint` only allows the ASCII space (U+0020).  Be more lenient
by using `unicode.IsGraphic` instead.

Fixes #8079
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants