summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/cyberlocker-tools
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-08-31 22:44:27 +0200
committerlassulus <lassulus@lassul.us>2021-08-31 22:44:27 +0200
commite8dc3141ae6a7f109c6ce9e5852dd1a62c60d543 (patch)
tree3f9e245af55d3727fb45df3dd074cca6bbb71e5b /krebs/5pkgs/simple/cyberlocker-tools
parent34930b3db2d4386e4826ae782f0c24044e45b9c5 (diff)
cyberlocker-tools: normalize url
Diffstat (limited to 'krebs/5pkgs/simple/cyberlocker-tools')
-rw-r--r--krebs/5pkgs/simple/cyberlocker-tools/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/krebs/5pkgs/simple/cyberlocker-tools/default.nix b/krebs/5pkgs/simple/cyberlocker-tools/default.nix
index d43be1d69..6e6563fb1 100644
--- a/krebs/5pkgs/simple/cyberlocker-tools/default.nix
+++ b/krebs/5pkgs/simple/cyberlocker-tools/default.nix
@@ -5,15 +5,19 @@ pkgs.symlinkJoin {
(pkgs.writers.writeDashBin "cput" ''
set -efu
path=''${1:-$(hostname)}
+ path=$(echo "/$path" | sed -E 's:/+:/:')
+ url=http://c.r$path
- ${pkgs.curl}/bin/curl -fSs --data-binary @- "http://c.r/$path"
- echo "http://c.r/$path"
+ ${pkgs.curl}/bin/curl -fSs --data-binary @- "$url"
+ echo "$url"
'')
(pkgs.writers.writeDashBin "cdel" ''
set -efu
path=$1
+ path=$(echo "/$path" | sed -E 's:/+:/:')
+ url=http://c.r$path
- ${pkgs.curl}/bin/curl -f -X DELETE "http://c.r/$path"
+ ${pkgs.curl}/bin/curl -f -X DELETE "$url"
'')
];
}