guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

251/376: nix-channel --add: Validate URL / channel ID


From: Ludovic Courtès
Subject: 251/376: nix-channel --add: Validate URL / channel ID
Date: Wed, 28 Jan 2015 22:05:24 +0000

civodul pushed a commit to tag 1.8
in repository guix.

commit a8925a510caab12da8ac12ae897ec5ba79b991c1
Author: Eelco Dolstra <address@hidden>
Date:   Tue Oct 14 11:28:13 2014 +0200

    nix-channel --add: Validate URL / channel ID
    
    Fixes #369.
---
 scripts/nix-channel.in |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in
index e45b913..8e07821 100755
--- a/scripts/nix-channel.in
+++ b/scripts/nix-channel.in
@@ -61,6 +61,8 @@ sub writeChannels {
 # Adds a channel.
 sub addChannel {
     my ($url, $name) = @_;
+    die "invalid channel URL ‘$url’" unless $url =~ /^(file|http|https):\/\//;
+    die "invalid channel identifier ‘$name’" unless $name =~ 
/^[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*$/;
     readChannels;
     $channels{$name} = $url;
     writeChannels;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]