@@ -127,27 +127,29 @@ app.post('/apps', function(req, res) {
127127 } ) ;
128128 }
129129
130+ var hfid = wflib . hfid , tmpdir = pathtool . join ( os . tmpdir ( ) , "HF-" + hfid ) ;
131+ if ( ! fs . existsSync ( tmpdir ) ) {
132+ fs . mkdirSync ( tmpdir ) ;
133+ }
134+
135+ var wfDir = pathtool . join ( tmpdir , makeId6 ( ) ) ;
136+ fs . mkdirSync ( wfDir ) ;
137+ console . log ( "WF DIR:" , wfDir ) ;
138+
139+
130140 // 1. Workflow can be sent as a zipped directory
131141 if ( ctype == "application/zip" ) {
132- var hfid = wflib . hfid , zipData = [ ] , size = 0 ;
142+ var zipData = [ ] , size = 0 ;
133143
134144 req . on ( 'data' , function ( data ) {
135145 zipData . push ( data ) ;
136146 size += data . length ;
137- console . log ( 'Got chunk: ' + data . length + ' total: ' + size ) ;
147+ //onsole .log('Got chunk: ' + data.length + ' total: ' + size);
138148 } ) ;
139149
140150 req . on ( 'end' , function ( ) {
141- var tmpdir = pathtool . join ( os . tmpdir ( ) , "HF-" + hfid ) ;
142- if ( ! fs . existsSync ( tmpdir ) ) {
143- fs . mkdirSync ( tmpdir ) ;
144- }
145-
146- var wfDir = pathtool . join ( tmpdir , makeId6 ( ) ) ;
147- fs . mkdirSync ( wfDir ) ;
148-
149151 var wffile ;
150- console . log ( "total size = " + size ) ;
152+ //onsole .log("total size = " + size);
151153
152154 var buf = new Buffer ( size ) ;
153155 for ( var i = 0 , len = zipData . length , pos = 0 ; i < len ; i ++ ) {
@@ -157,7 +159,7 @@ app.post('/apps', function(req, res) {
157159
158160 var zip = new AdmZip ( buf ) ;
159161 var zipEntries = zip . getEntries ( ) ;
160- console . log ( "ZIP ENTRIES:" , zipEntries . length ) ;
162+ //onsole .log("ZIP ENTRIES:", zipEntries.length);
161163 zip . extractAllTo ( wfDir ) ;
162164
163165 // Make sure this works correctly both when the zip contains a directory, or just files
@@ -171,7 +173,7 @@ app.post('/apps', function(req, res) {
171173 }
172174 }
173175 wffile = pathtool . join ( wfDir , "workflow.json" ) ;
174- console . log ( "WF FILE:" , wffile ) ;
176+ //onsole .log("WF FILE:", wffile);
175177
176178 // if there is a "package.json" file, install dependencies (npm install -d)
177179 // TODO: improve error checking etc.
0 commit comments