mitigate end tag false positive detection?
dai-shi opened this issue · comments
Daishi Kato commented
Not sure, but is it safe to assume </body></html>
appears just once?
- controller.enqueue(encoder.encode(buf.replace('</body></html>', '')));
+ controller.enqueue(encoder.encode(buf.replace(/<\/body><\/html>$/, '')));
to be a little safer?
Devon Govett commented
hmm not sure when there would be multiple bodies but good to be defensive I guess
Daishi Kato commented
yeah, maybe it would never happen with the output from React streaming.
Daishi Kato commented
if .endsWith('</body></html>')
then .slice(0, -'</body></html>'.length)
might be faster, not only safer.
But, it's up to you.
Daishi Kato commented
Re: 603012a
- controller.enqueue(encoder.encode('</body></html>'));
+ controller.enqueue(encoder.encode(trailer));