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

Error after upgrading to 0.35.0 #492

Closed
aselder opened this issue Oct 16, 2023 · 6 comments
Closed

Error after upgrading to 0.35.0 #492

aselder opened this issue Oct 16, 2023 · 6 comments
Labels

Comments

@aselder
Copy link

aselder commented Oct 16, 2023

Description

[error] GET /products/scalp-solutions-dry-scalp-treatment ** (MatchError) no match of right hand side value: [{"=", "="}, {""trade"", ""trade""}]
(floki 0.35.0) src/floki_mochi_html.erl:257: :floki_mochi_html.norm/2
(floki 0.35.0) src/floki_mochi_html.erl:241: :floki_mochi_html.tree/3
(floki 0.35.0) src/floki_mochi_html.erl:120: :floki_mochi_html.parse_tokens/2
(floki 0.35.0) lib/floki/html_parser/mochiweb.ex:10: Floki.HTMLParser.Mochiweb.parse_document/2
(tenant_web 0.1.0) lib/tenant_web/components/blocks/text.ex:130: TenantWeb.Components.Blocks.Text.maybe_render_with_existing_container/1
(tenant_web 0.1.0) lib/tenant_web/components/blocks/text.ex:17: TenantWeb.Components.Blocks.Text.render/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/tag_engine.ex:68: Phoenix.LiveView.TagEngine.component/3

To Reproduce

Steps to reproduce the behavior:

  • Using Floki v0.35.0
  • Using Elixir v1.15.6
  • Using Erlang OTP v25.3.2.6
  • With this code:
    # An example to reproduce the problem

Expected behavior

A description of what is the expected behavior using the code.

@aselder aselder added the Bug label Oct 16, 2023
@philss
Copy link
Owner

philss commented Oct 16, 2023

I'm into it. @aselder Is it possible to provide a snippet so I can reproduce the error?

@aselder
Copy link
Author

aselder commented Oct 16, 2023 via email

@philss
Copy link
Owner

philss commented Oct 16, 2023

OK, thank you!

@aselder
Copy link
Author

aselder commented Oct 16, 2023

@philss

Here’s some info that I think clarifies the root cause. I just tried to parse that html that was found to be bad on the one page:

<spanclass=\"trade\">™ curl gelée<br><br><br></spanclass=\"trade\">

With Floki 0.35.0, I get the same exact error we saw on production:

iex(3)> Floki.parse_fragment(f)
** (MatchError) no match of right hand side value: [{"=", "="}, {"\"trade\"", "\"trade\""}]
    (floki 0.35.0) src/floki_mochi_html.erl:257: :floki_mochi_html.norm/2
    (floki 0.35.0) src/floki_mochi_html.erl:241: :floki_mochi_html.tree/3
    (floki 0.35.0) src/floki_mochi_html.erl:120: :floki_mochi_html.parse_tokens/2
    (floki 0.35.0) lib/floki/html_parser/mochiweb.ex:10: Floki.HTMLParser.Mochiweb.parse_document/2
    iex:3: (file)

with Floki 0.34.3, it works:

iex(3)> Floki.parse_fragment(f)
{:ok,
 [
   {"spanclass", [{"=", "="}, {"\"trade\"", "\"trade\""}],
    ["™ curl gelée", {"br", [], []}, {"br", [], []}, {"br", [], []}]}
 ]}

So it was some invalid html that was not causing problem before, but after upgrading floki, it was an error

@philss philss closed this as completed in 000f4be Oct 16, 2023
@philss
Copy link
Owner

philss commented Oct 16, 2023

@aselder thank you so much! It was a silly mistake of mine. I'm going to release a patch version soon :)

@philss
Copy link
Owner

philss commented Oct 16, 2023

Done! Please try the version 0.35.1 :)

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

No branches or pull requests

2 participants