-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
regression: Fail to unmarshal JSON arrays #4361
Comments
I can confirm that it's not a permissions issue for reading (no permissions were changed between blogging yesterday and building the site today). Here is a summarized output (removing irrelevant dir content) of drwxrwxrwx 9 joshua joshua 4096 Dec 5 04:35 .
drwxrwxrwx 12 joshua joshua 4096 Jan 26 15:38 ..
-rw-rw-r-- 1 joshua joshua 1085 Sep 21 12:09 mirrors.json
-rw-rw-r-- 1 joshua joshua 308 May 14 2017 sws.json |
Likely related to the change from /cc @vassudanagunta |
on it |
Thanks @vassudanagunta 😄 |
OK, looking into this, while it is a regression, it worked before but partly out of luck, since parts of the code assume data files along with frontmatter are maps at the top level. Hence JSON arrays fail if you have two of them at the same level (#4366). A single JSON array file works, but not YAML (#3890, also forum discussion), which I confirmed in test. Other unmarshaling issues that may be connected/resolved together: #4138, #2441. If I can't come up with a broader solution soon, I'll role back just enough of 91bb774 to fix your case. |
@vassudanagunta any updates on this? |
In progress. Mostly have it. I'll PR a proposed fix within a few hours when I get some free time. |
@bep The main difficulty is that the various parsers (YAML, JSON, TOML) all behave differently. Getting close. What's the deadline? It would be nice to fix this rather than roll back (which trades one bug for another). If I get this right, I'll have squashed a number of bugs. |
This bug was introduced in Hugo 0.35. Fixes #4361
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. |
As of Hugo 0.35, I am no longer able to parse a valid JSON file for use in
.Site.Data.var
. Running--debug
reports:mirrors.json
is saved indata/
, with the contents of:sws.json
is saved indata/
, with the contents of:The failing to parse this JSON results in errors like:
With the respective line that it's erroring having:
{{ range where $site.Data.sws "episode" "==" $episode }}
I can confirm that it works as intended with Hugo 0.34, I released a blog not just yesterday, were both the Sundays with Solus shortcode, as well as Download mirrors dropdown work as intended. See https://solus-project.com/blog/ and https://solus-project.com/download/
The text was updated successfully, but these errors were encountered: