cyberlocker-tools: normalize url

This commit is contained in:
lassulus 2021-08-31 22:44:27 +02:00
parent 34930b3db2
commit e8dc3141ae

View File

@ -5,15 +5,19 @@ pkgs.symlinkJoin {
(pkgs.writers.writeDashBin "cput" '' (pkgs.writers.writeDashBin "cput" ''
set -efu set -efu
path=''${1:-$(hostname)} 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" ${pkgs.curl}/bin/curl -fSs --data-binary @- "$url"
echo "http://c.r/$path" echo "$url"
'') '')
(pkgs.writers.writeDashBin "cdel" '' (pkgs.writers.writeDashBin "cdel" ''
set -efu set -efu
path=$1 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"
'') '')
]; ];
} }