[GH-ISSUE #369] error on line 8 at column 1: Extra content at the end of the document #227

Closed
opened 2026-03-03 14:35:36 +03:00 by kerem · 27 comments
Owner

Originally created by @popovoleksandr on GitHub (May 22, 2017).
Original GitHub issue: https://github.com/lipis/flag-icons/issues/369

Could you please help me. I'm using Laravel and your package installed using npm.
However I got this error
image

Originally created by @popovoleksandr on GitHub (May 22, 2017). Original GitHub issue: https://github.com/lipis/flag-icons/issues/369 Could you please help me. I'm using Laravel and your package installed using npm. However I got this error ![image](https://cloud.githubusercontent.com/assets/7561827/26301221/2d15cd48-3ee9-11e7-9ce5-1e03e036b1ba.png)
kerem closed this issue 2026-03-03 14:35:36 +03:00
Author
Owner

@lipis commented on GitHub (May 22, 2017):

Works here: https://lipis.github.io/flag-icon-css/flags/4x3/ua.svg

<!-- gh-comment-id:303049103 --> @lipis commented on GitHub (May 22, 2017): Works here: https://lipis.github.io/flag-icon-css/flags/4x3/ua.svg
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

Yes I can see that... however following source code is delivered by above link:

<svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480">
  <g fill-rule="evenodd" stroke-width="1pt">
    <path fill="#ffd500" d="M0 0h640v480H0z"/>
    <path fill="#005bbb" d="M0 0h640v240H0z"/>
  </g>
</svg>

</svg>

basicly for all flags delivered smth different. For instance for /fonts/ga.svg?3bccb26524d04e3abb3dc4fa8b5047df

<svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480">
  <g fill-rule="evenodd">
    <path fill="#ffe700" d="M640 480H0V0h640z"/>
    <path fill="#36a100" d="M640 160.003H0V0h640z"/>
    <path fill="#006dbc" d="M640 480H0V319.997h640z"/>
  </g>
</svg>
1.33h512.004z"/>
  </g>
</svg>
<!-- gh-comment-id:303049818 --> @popovoleksandr commented on GitHub (May 22, 2017): Yes I can see that... however following source code is delivered by above link: ``` <svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480"> <g fill-rule="evenodd" stroke-width="1pt"> <path fill="#ffd500" d="M0 0h640v480H0z"/> <path fill="#005bbb" d="M0 0h640v240H0z"/> </g> </svg> </svg> ``` basicly for all flags delivered smth different. For instance for /fonts/ga.svg?3bccb26524d04e3abb3dc4fa8b5047df ``` <svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480"> <g fill-rule="evenodd"> <path fill="#ffe700" d="M640 480H0V0h640z"/> <path fill="#36a100" d="M640 160.003H0V0h640z"/> <path fill="#006dbc" d="M640 480H0V319.997h640z"/> </g> </svg> 1.33h512.004z"/> </g> </svg> ```
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

BTW /fonts/gb.svg?fd72d9b5184b47afb2f7b4db0c8a35de is working perfectly fine... I'm bit confused.
I cleaned and republished node_modules but it did not helped

<!-- gh-comment-id:303050793 --> @popovoleksandr commented on GitHub (May 22, 2017): BTW /fonts/gb.svg?fd72d9b5184b47afb2f7b4db0c8a35de is working perfectly fine... I'm bit confused. I cleaned and republished node_modules but it did not helped
Author
Owner

@Findus23 commented on GitHub (May 22, 2017):

https://lipis.github.io/flag-icon-css/flags/4x3/ua.svg returns


<svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480">
  <g fill-rule="evenodd" stroke-width="1pt">
    <path fill="#ffd500" d="M0 0h640v480H0z"/>
    <path fill="#005bbb" d="M0 0h640v240H0z"/>
  </g>
</svg>

for me. Have you got any browser extension which modifies the response?

<!-- gh-comment-id:303051112 --> @Findus23 commented on GitHub (May 22, 2017): https://lipis.github.io/flag-icon-css/flags/4x3/ua.svg returns ```svg <svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480"> <g fill-rule="evenodd" stroke-width="1pt"> <path fill="#ffd500" d="M0 0h640v480H0z"/> <path fill="#005bbb" d="M0 0h640v240H0z"/> </g> </svg> ``` for me. Have you got any browser extension which modifies the response?
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

@Findus23 on GitHub it working fine... Im not able to get it into my code fully :(
Thus any help is really appreciated

<!-- gh-comment-id:303051671 --> @popovoleksandr commented on GitHub (May 22, 2017): @Findus23 on GitHub it working fine... Im not able to get it into my code fully :( Thus any help is really appreciated
Author
Owner

@Findus23 commented on GitHub (May 22, 2017):

Maybe open the local svg file in the node_modules folder and check if it has a duplicate </svg>

<!-- gh-comment-id:303051939 --> @Findus23 commented on GitHub (May 22, 2017): Maybe open the local svg file in the node_modules folder and check if it has a duplicate `</svg>`
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

Double checked - local files are fine...

<!-- gh-comment-id:303052844 --> @popovoleksandr commented on GitHub (May 22, 2017): Double checked - local files are fine...
Author
Owner

@Findus23 commented on GitHub (May 22, 2017):

The next step would be checking the http request in the developer tools

<!-- gh-comment-id:303053190 --> @Findus23 commented on GitHub (May 22, 2017): The next step would be checking the http request in the developer tools
Author
Owner

@lipis commented on GitHub (May 22, 2017):

also try from different browser.

<!-- gh-comment-id:303053646 --> @lipis commented on GitHub (May 22, 2017): also try from different browser.
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

Thanks for support. However followng are dev tools both Chrome and Firefox:
image

<!-- gh-comment-id:303054196 --> @popovoleksandr commented on GitHub (May 22, 2017): Thanks for support. However followng are dev tools both Chrome and Firefox: ![image](https://cloud.githubusercontent.com/assets/7561827/26302670/acb624ea-3eed-11e7-9bb9-d2a247766051.png)
Author
Owner

@Findus23 commented on GitHub (May 22, 2017):

If you click on the request, you can see its content:
screenshot_20170522_115501

<!-- gh-comment-id:303054677 --> @Findus23 commented on GitHub (May 22, 2017): If you click on the request, you can see its content: ![screenshot_20170522_115501](https://cloud.githubusercontent.com/assets/6266037/26302742/8bebebf8-3ee5-11e7-9d22-4aa263e2ed1a.png)
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

Could you tell me what should I look for? Thanks!

<!-- gh-comment-id:303055086 --> @popovoleksandr commented on GitHub (May 22, 2017): Could you tell me what should I look for? Thanks!
Author
Owner

@Findus23 commented on GitHub (May 22, 2017):

Check in "Response" if the duplicate </svg> is also there

<!-- gh-comment-id:303055639 --> @Findus23 commented on GitHub (May 22, 2017): Check in "Response" if the duplicate `</svg>` is also there
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

@lipis could you help me understand how route like /font/*svg is working?
@Findus23 yes it contains that is weird :(

<!-- gh-comment-id:303067780 --> @popovoleksandr commented on GitHub (May 22, 2017): @lipis could you help me understand how route like /font/*svg is working? @Findus23 yes it contains that is weird :(
Author
Owner

@lipis commented on GitHub (May 22, 2017):

What do you mean?! If you just open that SVG in your browser does it work?! If the answer is yes.. then the problem is not in the svg.. but the way you use it..

<!-- gh-comment-id:303069444 --> @lipis commented on GitHub (May 22, 2017): What do you mean?! If you just open that SVG in your browser does it work?! If the answer is yes.. then the problem is not in the svg.. but the way you use it..
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

SOrry if it was misunderstanding.
As you can see on my screenshot I sent hour ago it is not displayed for UA and RU but showed for GB. SO answer is Yes and No. I'm using it like this:
<span class="flag-icon flag-icon-ru"></span>

After I got following style class

.flag-icon-ru {
    background-image: url(/fonts/ru.svg?073f6ef795fdf4440534d05fa592f2d0);
}

If I go to that link I will receive:

<svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480">
  <g fill-rule="evenodd" stroke-width="1pt">
    <path fill="#fff" d="M0 0h640v480H0z"/>
    <path fill="#0039a6" d="M0 160.003h640V480H0z"/>
    <path fill="#d52b1e" d="M0 319.997h640V480H0z"/>
  </g>
</svg>
</g>
</svg>
<!-- gh-comment-id:303070217 --> @popovoleksandr commented on GitHub (May 22, 2017): SOrry if it was misunderstanding. As you can see on my screenshot I sent hour ago it is not displayed for UA and RU but showed for GB. SO answer is Yes and No. I'm using it like this: `<span class="flag-icon flag-icon-ru"></span>` After I got following style class ``` .flag-icon-ru { background-image: url(/fonts/ru.svg?073f6ef795fdf4440534d05fa592f2d0); } ``` If I go to that link I will receive: ``` <svg xmlns="http://www.w3.org/2000/svg" height="480" width="640" viewBox="0 0 640 480"> <g fill-rule="evenodd" stroke-width="1pt"> <path fill="#fff" d="M0 0h640v480H0z"/> <path fill="#0039a6" d="M0 160.003h640V480H0z"/> <path fill="#d52b1e" d="M0 319.997h640V480H0z"/> </g> </svg> </g> </svg> ```
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

@lipis could you point me out where I'm doing mistake. Thank you!

<!-- gh-comment-id:303070296 --> @popovoleksandr commented on GitHub (May 22, 2017): @lipis could you point me out where I'm doing mistake. Thank you!
Author
Owner

@lipis commented on GitHub (May 22, 2017):

No I can't sorry.. the SVG is correct and the last two lines are added by your setup.. remove those lines and it will be fixed!

<!-- gh-comment-id:303071071 --> @lipis commented on GitHub (May 22, 2017): No I can't sorry.. the SVG is correct and the last two lines are added by your setup.. remove those lines and it will be fixed!
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

Pity.. anyway thanks for your time

<!-- gh-comment-id:303071793 --> @popovoleksandr commented on GitHub (May 22, 2017): Pity.. anyway thanks for your time
Author
Owner

@lipis commented on GitHub (May 22, 2017):

Pity?! How do you think we should help you exactly?! Should we start using Laravel, try to guess your full setup? try to guess your browsers, your machine and all your pipeline to figure out what is wrong with the rendering of SVG that actually is correct?!

<!-- gh-comment-id:303072394 --> @lipis commented on GitHub (May 22, 2017): Pity?! How do you think we should help you exactly?! Should we start using Laravel, try to guess your full setup? try to guess your browsers, your machine and all your pipeline to figure out what is wrong with the rendering of SVG that actually is correct?!
Author
Owner

@popovoleksandr commented on GitHub (May 22, 2017):

No of cource not... I just said thank you for your time.
Youre right npm is adding this during compilation. But I'm not sure why and how to fix it.

<!-- gh-comment-id:303073124 --> @popovoleksandr commented on GitHub (May 22, 2017): No of cource not... I just said thank you for your time. Youre right npm is adding this during compilation. But I'm not sure why and how to fix it.
Author
Owner

@lipis commented on GitHub (May 22, 2017):

np.. and good luck.

<!-- gh-comment-id:303073931 --> @lipis commented on GitHub (May 22, 2017): np.. and good luck.
Author
Owner

@Outridair commented on GitHub (Apr 23, 2018):

Hey Love your work here @lipis thanks for making this package.

I think I have the solution for @anantaramdas here.

When using laravel-mix for compiling the sass and js files, if you use the sass version.
@import './components/flags/flag-icon.scss';
This will add that terrible extra few lines on the end, something wrong with how the default laravel-mix configuration is perhaps.

However if you follow -> https://github.com/lipis/flag-icon-css/issues/428

And add it to the app.js file after an npm install import 'flag-icon-css/css/flag-icon.css'
Everything should compile like normal, and you can add the flags as per the README.MD

Hope that helps!

<!-- gh-comment-id:383449599 --> @Outridair commented on GitHub (Apr 23, 2018): Hey Love your work here @lipis thanks for making this package. I think I have the solution for @anantaramdas here. When using laravel-mix for compiling the sass and js files, if you use the sass version. `@import './components/flags/flag-icon.scss';` This will add that terrible extra few lines on the end, something wrong with how the default laravel-mix configuration is perhaps. However if you follow -> https://github.com/lipis/flag-icon-css/issues/428 And add it to the app.js file after an npm install `import 'flag-icon-css/css/flag-icon.css'` Everything should compile like normal, and you can add the flags as per the README.MD Hope that helps!
Author
Owner

@lipis commented on GitHub (Apr 23, 2018):

@The-Outrider do we have to update anything in the project, or it's just how people are using with different packages/frameworks?

<!-- gh-comment-id:383501986 --> @lipis commented on GitHub (Apr 23, 2018): @The-Outrider do we have to update anything in the project, or it's just how people are using with different packages/frameworks?
Author
Owner

@Outridair commented on GitHub (Apr 23, 2018):

@lipis I believe this is an issue in the laravel-mix package, and no code changes need to be made here. 👍

<!-- gh-comment-id:383623365 --> @Outridair commented on GitHub (Apr 23, 2018): @lipis I believe this is an issue in the laravel-mix package, and no code changes need to be made here. 👍
Author
Owner

@lipis commented on GitHub (Apr 23, 2018):

Thanks @The-Outrider

<!-- gh-comment-id:383678732 --> @lipis commented on GitHub (Apr 23, 2018): Thanks @The-Outrider
Author
Owner

@GwFreak01 commented on GitHub (Sep 24, 2019):

@anantaramdas
Hey, I am running into the same issue and was curious what your solution was. In my case, it seems that Webpack is trying to bundle/compile these assets and something related to the write buffer is adding on the extra gibberish at the end, but I'm not too exactly sure.

Any lead would help!
Thanks!

<!-- gh-comment-id:534648193 --> @GwFreak01 commented on GitHub (Sep 24, 2019): @anantaramdas Hey, I am running into the same issue and was curious what your solution was. In my case, it seems that Webpack is trying to bundle/compile these assets and something related to the write buffer is adding on the extra gibberish at the end, but I'm not too exactly sure. Any lead would help! Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/flag-icons#227
No description provided.