How does builtins.fetchurl save a data?

Hello. I called fetchurl twice with different urls, but with same hash parameters, the hash of a data from the link is different. The result was that i got the same data (data should have been different).

icon = builtins.fetchurl {
    url = "https://www.youtube.com/s/desktop/510f0670/img/favicon.ico";
    sha256 = "07cip1niccc05p124xggbmrl9p3n9kvzcinmkpakcx518gxd1ccb";
};
...
icon = builtins.fetchurl {
    url = "https://www.linux.org.ru/favicon.ico";
    sha256 = "07cip1niccc05p124xggbmrl9p3n9kvzcinmkpakcx518gxd1ccb";
};

I was setting search engines for home-manager firefox. This is how home-manager puts a data to the firfox parameter. I’m just worried it might be a bug.

It’s not a bug, but it is a common gotcha.

You’ve essentially told Nix you have two fixed output derivations with the same hash (in other words they are equal) - so it concludes it doesn’t need to download the file.

The hash relates to the output, not the file downloaded by builtins.fetchurl per se.

See this page for a more thorough explanation.