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

Ignore BOM in package.json when submitting a package #4135

Open
2 tasks done
mvriel opened this issue Jul 19, 2023 · 5 comments
Open
2 tasks done

Ignore BOM in package.json when submitting a package #4135

mvriel opened this issue Jul 19, 2023 · 5 comments

Comments

@mvriel
Copy link
Contributor

mvriel commented Jul 19, 2023

Feature request

When you submit a new package using the website and the package.json of that package contains a Byte Order Marker (BOM), then an error is shown that says it encountered invalid characters at the start of the package.json.

I think it would be beneficial if, prior to sending it to the parser, the reader strips the BOM itself when present; or a the least it shows a more descriptive error message when a BOM is present.

Feature category

  • Website: improve the way to browse or discover packages.
  • Pipelines: improve the way to publish or manage a package.

What problem does this feature solve?

Being unable to submit a package and helping developers get their package submitted if they do not know about BOM.

How should this be implemented in your opinion?

I think it would be beneficial if, prior to sending it to the parser, the reader strips the BOM itself when present; or a the least it shows a more descriptive error message when a BOM is present.

Are you a regular backer or sponsor at patreon.com/openupm?

No

Are you willing to work on this yourself?

Not at this moment, I have too much on my plate to take on this extra task

@favoyang
Copy link
Member

Could you provide an example repository?

@favoyang
Copy link
Member

BTW, I don't think a package.json with BOM can work in Unity:

#2804

https://forum.unity.com/threads/apparently-my-package-json-is-invalid-when-trying-to-add-my-own-package.1175081/#post-7531058

The BOM should be removed before submitting to openupm. Perhaps the error message could be better than Unexpected token ... in JSON at position 0, however better than nothing.

@mvriel
Copy link
Contributor Author

mvriel commented Jul 19, 2023

The package version that I tried to submit: https://github.com/Netherlands3D/Json-Extras/tree/a2bf1e27ad47b4303e4e224f0f8f5327cdea51ee (the next commit is the BOM fix)

And this repository worked in Unity, so it would seem that Unity strips the BOM internally?

@mvriel
Copy link
Contributor Author

mvriel commented Jul 19, 2023

Also: it may be a Rider thing; I have now applied the fix as suggested in https://forum.unity.com/threads/apparently-my-package-json-is-invalid-when-trying-to-add-my-own-package.1175081/#post-7533989 to prevent Rider from adding BOMs :)

@favoyang
Copy link
Member

And this repository worked in Unity, so it would seem that Unity strips the BOM internally?

Thanks for the info. Then we shall align with the Unity editor.

Let's keep this open. For now, it's a low priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants