diff options
| author | hallgren <hallgren@chalmers.se> | 2011-07-07 13:30:56 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2011-07-07 13:30:56 +0000 |
| commit | c7fffd861b4fa74afc450be2970cd8cf63f64a88 (patch) | |
| tree | 4a38edebc5b6027bd8f4737e833c117af7cb85c2 /src/editor/simple/upload.cgi | |
| parent | f224ead86b266c3c6c01a68c592ea589b0eba1bd (diff) | |
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.
Diffstat (limited to 'src/editor/simple/upload.cgi')
| -rw-r--r-- | src/editor/simple/upload.cgi | 26 |
1 files changed, 26 insertions, 0 deletions
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 |
