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

GET parameters are deleted from flake input url paths #11920

Open
ivan-tkatchev opened this issue Nov 20, 2024 · 1 comment
Open

GET parameters are deleted from flake input url paths #11920

ivan-tkatchev opened this issue Nov 20, 2024 · 1 comment
Labels

Comments

@ivan-tkatchev
Copy link

Describe the bug

        /* The URL query parameters serve two roles: specifying fetch
           settings for Nix itself, and arbitrary data as part of the
           HTTP request. Now that we've processed the Nix-specific
           attributes above, remove them so we don't also send them as
           part of the HTTP request. */
        for (auto & param : allowedAttrs())
            url.query.erase(param);

        input.attrs.insert_or_assign("type", std::string { schemeName() });
        input.attrs.insert_or_assign("url", url.to_string());
    StringSet allowedAttrs() const override
    {
        return {
            "type",
            "url",
            "narHash",
            "name",
            "unpack",
            "rev",
            "revCount",
            "lastModified",
        };
    }

If a flake url has name or type as parameters, then they will be silently removed from the url.

"name" and "type" are extremely common names for parameters and aren't Nix-specific, silently removing them is a big usability bug.

@ivan-tkatchev
Copy link
Author

Counterintuitively, specifying a flake like this, with a "type" = "file" attrset key turns off the GET parameter removal logic.

    important-key = {
      url = "https://example.com/export?type=whatever";
      type = "file";
      flake = false;
    };

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

1 participant