~moody/rc-gemd

220cfb7a23dd0e6f6efb2cabe1389e723073e5b6 — Jacob Moody 2 months ago 7fa8b48
fix urlencode escape, copied from rc-httpd
2 files changed, 8 insertions(+), 0 deletions(-)

M handlers/dir-index
M handlers/serve-static
M handlers/dir-index => handlers/dir-index +4 -0
@@ 1,6 1,10 @@
#!/bin/rc
full_path=`{echo $"fs_root^$"location | urlencode -d}
full_path=$"full_path
if(! ~ `{cleanname -d$fs_root $full_path} `{cleanname $fs_root}^*){
	error 53 'path not allowed'
	exit
}

echo '20 text/gemini'^$cr
ls $full_path | sed '

M handlers/serve-static => handlers/serve-static +4 -0
@@ 1,6 1,10 @@
#!/bin/rc
full_path=`{echo $"fs_root^$"location | urlencode -d}
full_path=$"full_path
if(! ~ `{cleanname -d$fs_root $full_path} `{cleanname $fs_root}^*){
	error 53 'path not allowed'
	exit
}

if(! test -e $full_path){
	error 51 'file does not exist'