From c7fffd861b4fa74afc450be2970cd8cf63f64a88 Mon Sep 17 00:00:00 2001 From: hallgren Date: Thu, 7 Jul 2011 13:30:56 +0000 Subject: gfse: grammars in the cloud, work in progress Cloud merging: when sharing grammars between two devices that previously each had separate grammar directoies on the server, clean up one of the directories and make it a symbolic link to the other. --- src/editor/simple/upload.cgi | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/editor/simple/upload.cgi') diff --git a/src/editor/simple/upload.cgi b/src/editor/simple/upload.cgi index f7dd936f9..ec262a062 100644 --- a/src/editor/simple/upload.cgi +++ b/src/editor/simple/upload.cgi @@ -153,6 +153,32 @@ case "$REQUEST_METHOD" in *) error400 esac ;; + rmdir=*) + dir=$(qparse "$QUERY_STRING" rmdir) + case "$dir" in + /tmp/gfse.*) # shouldn't allow .. in path !!! + path="$documentRoot$dir" + if [ -d "$path" ] ; then + ContentType="text/plain; charset=$charset" + cgiheaders + cd "$path" + rm *.gf *.gfo *-*.json *.pgf grammars.cgi + cd .. + rmdir "$path" + newdir=$(qparse "$QUERY_STRING" newdir) + case "$newdir" in + /tmp/gfse.*) # shouldn't allow .. in path !!! + newnode="${newdir##*/}" + oldnode="${path##*/}" + ln -s "$newnode" "$oldnode" + esac + else + error404 + fi + ;; + *) error400 + esac + ;; download=*) file=$(qparse "$QUERY_STRING" download) case "$file" in -- cgit v1.2.3