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

Version 1.18.3 does not have defaults defined #242

Closed
a-novelo opened this issue Aug 1, 2018 · 7 comments
Closed

Version 1.18.3 does not have defaults defined #242

a-novelo opened this issue Aug 1, 2018 · 7 comments

Comments

@a-novelo
Copy link

a-novelo commented Aug 1, 2018

When working with version 1.18.2 I was able to access sanitizeHtml.defaults but with version 1.18.3 I'm getting undefined. If I rollback to the former version, there are no problems with the following line:
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['h1', 'h2'])

@conways-glider
Copy link

This is a potential duplicate of #241

@boutell
Copy link
Member

boutell commented Aug 2, 2018

Thanks, that makes more sense. My guess is the tests never do this. Obviously we'll add one.

@boutell
Copy link
Member

boutell commented Aug 2, 2018

Actually the tests do use the defaults object in exactly this way.

Are you using the frontend build? I don't see any issues with this in src/index.js or its tests, i.e. what server side code sees.

What I do see is that dist/sanitize-html.js (front end) looks way too short to be valid. But I haven't the slightest why that is happening unfortunately. I wonder if something changed in browserify.

Don't get me wrong here, if there's a bug in the original src/index.js or in dist/index.js please enlighten me with specifics of how to reproduce it. But I can't find one with the tests that are using the exported defaults property.

@finom
Copy link

finom commented Aug 2, 2018

Getting the same issue installing the package via NPM.

dbkr added a commit to matrix-org/matrix-react-sdk that referenced this issue Aug 2, 2018
dbkr added a commit to element-hq/element-web that referenced this issue Aug 2, 2018
@felixfbecker
Copy link

This was caused by gitignoring and removing package-lock.json in https://github.com/punkave/sanitize-html/pull/240/files#diff-32607347f8126e6534ebc7ebaec4853d. What is the reason this was done? It seems that without the lockfile, some devDependency was silently updated, which changed the build output. This is exactly what lockfiles are there for to prevent - making the build reproducible and deterministic, so breakages can't suddenly happen without any changes to master. Please keep a lockfile checked in.

felixfbecker added a commit to felixfbecker/sanitize-html that referenced this issue Aug 2, 2018
Closes apostrophecms#242 and prevents breakages like it in the future.
@a-novelo
Copy link
Author

a-novelo commented Aug 2, 2018

Seems this solves the problem. Thank you Felix, I'm closing the issue.

@a-novelo a-novelo closed this as completed Aug 2, 2018
@felixfbecker
Copy link

To anyone reading this, the problem was actually not caused by that commit / the lockfile, the previous release wasn't tagged right. See #241 (comment)

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

No branches or pull requests

5 participants