[ t ] [
mime-test-stream [ upload-separator parse-multipart ] with-input-stream
- drop "up.txt" swap key?
+ drop "\"up.txt\"" swap key?
] unit-test
[ t ] [
mime-test-stream [ upload-separator parse-multipart ] with-input-stream
- nip "text1" swap key?
+ nip "\"text1\"" swap key?
] unit-test
parse-headers >hashtable >>header
] if ;
-: quote? ( ch -- ? ) "'\"" member? ;
-
-: quoted? ( str -- ? )
- {
- [ length 1 > ]
- [ first quote? ]
- [ [ first ] [ peek ] bi = ]
- } 1&& ;
-
-: unquote ( string -- string' )
- dup quoted? [ but-last-slice rest-slice >string ] when ;
-
: save-uploaded-file ( multipart -- )
- [ unquote ] change-filename
dup filename>> empty? [
drop
] [
] if ;
: save-form-variable ( multipart -- )
- [ unquote ] change-name
[ [ header>> ] [ name>> ] [ name-content>> ] tri mime-variable boa ]
[ name>> ]
[ form-variables>> set-at ] tri ;