JonStargaryen 4 years ago
parent
commit
96dea14cb1

+ 1 - 1
src/servers/model/server/api-web.ts

@@ -139,7 +139,7 @@ function createMultiJob(spec: MultipleQuerySpec, res: express.Response) {
             copyAllCategories: !!q.copy_all_categories
         })),
         writer,
-        options: { binary: spec.encoding?.toLowerCase() === 'bcif', tarball: spec.asTarGz, download: spec.download }
+        options: { binary: spec.encoding?.toLowerCase() === 'bcif', tarball: spec.asTarGz, download: !!spec.download }
     });
     responseMap.set(jobId, res);
     if (JobManager.size === 1) processNextJob();

+ 1 - 2
src/servers/model/server/api.ts

@@ -292,12 +292,11 @@ export function normalizeRestCommonParams(params: any): CommonQueryParamsInfo {
     return {
         model_nums: params.model_nums ? ('' + params.model_nums).split(',').map(n => n.trim()).filter(n => !!n).map(n => +n) : void 0,
         data_source: params.data_source,
+        // Boolean('false') return true
         copy_all_categories: params.copy_all_categories === 'true',
-        // copy_all_categories: Boolean(params.copy_all_categories),
         encoding: mapEncoding(('' + params.encoding).toLocaleLowerCase()),
         transform: params.transform ? ('' + params.transform).split(',').map(n => n.trim()).map(n => +n) as Mat4 : Mat4.identity(),
         download: params.download === 'true'
-        // download: Boolean(params.download)
     };
 }
 

+ 1 - 0
src/servers/model/utils/writer.ts

@@ -48,6 +48,7 @@ export class SimpleResponseResultWriter implements WebResutlWriter {
         this.headerWritten = true;
 
         this.res.writeHead(200, {
+            // TODO there seems to be a bug in swagger-ui - front-end will freeze for cif delivered as text/plain (forcing binary is a hack to circumvent this)
             'Content-Type': this.isBinary ? 'application/octet-stream' : 'text/plain; charset=utf-8',
             'Access-Control-Allow-Origin': '*',
             'Access-Control-Allow-Headers': 'X-Requested-With',