Skip to content

nix-prefetch-url fails to put package in store with some URLs #247

Closed

Description

@Fuuzetsu
nix-prefetch-url https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU

downloads the file and then exits with

invalid character `&' in name `uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU' at /run/current-system/sw/bin/nix-prefetch-url line 122.

This particular example is cantata-1.3.4 which uses Google Drive as Google code stopped offering downloads.

Perhaps we should be able to specify what the name a download is stored under. For example, the Gentoo ebuild does this.

Activity

  1. Fuuzetsu commented on May 2, 2014

    @Fuuzetsu
    MemberAuthor

    I also note that this causes problems for fetchurl.

  2. vcunat commented on May 2, 2014

    @vcunat
    Member

    For fetchurl it's folklore to fix it by setting suitable name = "foo";. I know of no (direct) way for nix-prefetch-url yet, and adding --name could be a nice solution.

  3. Fuuzetsu commented on May 2, 2014

    @Fuuzetsu
    MemberAuthor

    No matter what name is, if there is & in the url value, I can't build the package. My temporary workaround involved using tinyurl.com to generate a URL without & in it.

  4. vcunat commented on May 2, 2014

    @vcunat
    Member

    For a workaround you can download the file by another way and then nix-prefetch-url file://...

  5. abbradar commented on Nov 14, 2014

    @abbradar
    Member

    Got bitten with this -- there are indeed workarounds but it would be nice to fix this in nix-prefetch-url.

  6. strout commented on Apr 30, 2017

    @strout

    Is this fixed? The following works fine:

    nix-prefetch-url 'https://drive.google.com/uc?export=download&id=0Bzghs6gQWi60WTYtaXk3c1IzNVU' --name foo

    As does passing name = "foo" to fetchurl.

  7. armijnhemel commented on Apr 30, 2017

    @armijnhemel
    Contributor

    Is this from the command line, or from within a script? If it is from the commandline, then it is likely that the shell is the problem, as & has special meaning there (to make something a background process). If it is from the commandline, then this is not a bug, but expected behaviour.

  8. edolstra commented on Feb 1, 2018

    @edolstra
    Member

    Closing as by design. You can use --name to set a valid name if needed.

  9. added a commit that references this issue on Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions