theme-check icon indicating copy to clipboard operation
theme-check copied to clipboard

ValidJson check and autofix behave badly

Open trollkotze opened this issue 2 years ago • 6 comments

Describe the bug If "ValidJson" is enabled, it will remove unnecessary escapes (backslashes) from JSON on "autofix". That is unnecessary. Those backslashes don't make the JSON invalid.

This would not be so bad, if Shopify did not insert those backslashes when downloading the theme. Shopify adding those backslashes on every theme download (also with the GitHub integration, with backslashes appearing automatically in commits after settings changes) and theme-check removing them adds a lot of annoying, unnecessary changes in version control.

If "ValidJson" is disabled, it will completely delete contents of settings_data.json and settings_schema.json and overwrite them with the string "null", instead of leaving them alone. That really sucks.

Expected If "ValidJson" is enabled, it should not remove backslash escapes on autofix which are only unnecessary but don't make the JSON invalid.

If "ValidJson" is disabled, it should leave the settings_data.json and settings_schema.json untouched, instead of removing all contents and writing 'null' into them.

Actual If "ValidJson" is enabled, it will remove unnecessary escapes (backslashes) from JSON on "autofix".

If "ValidJson" is disabled, it will completely delete the settings_data.json, instead of leaving it alone.

Stack trace not applicable

Debugging information

  • OS Linux Mint 20.1
  • Version 1.11.0

trollkotze avatar Oct 06 '22 11:10 trollkotze

I have the same issue, it's really annoiyng during Code Reviews. Anyone with a solution ?

leopoldo-ud avatar May 12 '23 08:05 leopoldo-ud

if Shopify did not insert those backslashes when downloading the theme.

That's news to me, and the real bug. If you upload without slashes and it gets downloaded with slashes. That ain't good.

charlespwd avatar May 15 '23 12:05 charlespwd

@charlespwd charlespwd

if Shopify did not insert those backslashes when downloading the theme.

That's news to me, and the real bug. If you upload without slashes and it gets downloaded with slashes. That ain't good.

Probably not exactly "when downloading" but whenever settings are updated through the theme editor.

moritz-pv avatar May 21 '23 02:05 moritz-pv

I'm running into both (shopify constantly adding backslashes and/or entire json files being replaced with the word "null") of these issues constantly.

saiichihashimoto avatar Oct 31 '23 18:10 saiichihashimoto

That's news to me, and the real bug. If you upload without slashes and it gets downloaded with slashes. That ain't good. Both are bugs, smartass. But this is the one I filed here because it's in the scope of this repo. I don't know where to file a bug for all the internal bad behaviours of Shopify. Of course filing bugs here is just as useful as complaining to Shopify support or asking in the Shopify forums.

trollkotze avatar Mar 29 '24 07:03 trollkotze

The personal insult isn't necessary, @trollkotze.

Lots of things to fix over here with limited resources. This is getting fixed, but is low priority compared to helping merchants be more successful.

charlespwd avatar Apr 03 '24 12:04 charlespwd