Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Only injects code into the first occurrence of <head> tags #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nathanhoel
Copy link

This partially addresses issue #60

I think the idea was that https://github.com/johnbintz/rack-livereload/blob/master/lib/rack/livereload/body_processor.rb#L73 would prevent this issue from occurring.
However RACK can pass the entire document as a single line. So when entering this section of code the @livereload_added would still be false and then it would proceed to replace all occurrences of the text <head> with the injected code.

This fix simply makes sure we replace only the first occurrence of <head> as I believe was intended by the check found on line 73 of the body_processor.rb.

@nathanhoel
Copy link
Author

If I rebased this would someone be willing to merge this PR?

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

Successfully merging this pull request may close these issues.

1 participant