|
16 | 16 |
|
17 | 17 | const Sequelize = require('sequelize'); |
18 | 18 | const fs = require('fs'); |
| 19 | +const path = require('path'); |
19 | 20 | const JSONStream = require('JSONStream'); |
20 | 21 | const Database = require('./models/database'); |
21 | 22 | const {parentPath} = require('./models/databaseUtils'); |
@@ -185,9 +186,15 @@ class WorkbenchDB { |
185 | 186 | .then((db) => db.File.findAll(query)) |
186 | 187 | .then((files) => { |
187 | 188 | return files.map((file) => { |
| 189 | + let file_name; |
| 190 | + if (!file.name) { |
| 191 | + file_name = path.basename(file.path); |
| 192 | + } else { |
| 193 | + file_name = file.name; |
| 194 | + } |
188 | 195 | return { |
189 | 196 | id: file.path, |
190 | | - text: file.name, |
| 197 | + text: file_name, |
191 | 198 | parent: file.parent, |
192 | 199 | type: this.determineJSTreeType(file, promises), |
193 | 200 | children: file.type === 'directory' |
@@ -290,11 +297,6 @@ class WorkbenchDB { |
290 | 297 | }; |
291 | 298 | } |
292 | 299 |
|
293 | | - // Show error for scans missing file type information |
294 | | - if (header.scancode_options['--info'] === undefined) { |
295 | | - reject(new WorkbenchDB.MissingFileInfoError()); |
296 | | - } |
297 | | - |
298 | 300 | $.extend(header, { |
299 | 301 | workbench_version: version, |
300 | 302 | workbench_notice: 'Exported from ScanCode Workbench and provided on an "AS IS" BASIS, WITHOUT WARRANTIES\\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\\nScanCode Workbench should be considered or used as legal advice. Consult an Attorney\\nfor any legal advice.\\nScanCode Workbench is a free software analysis application from nexB Inc. and others.\\nVisit https://github.com/nexB/scancode-workbench/ for support and download."' |
@@ -510,6 +512,4 @@ class WorkbenchDB { |
510 | 512 | } |
511 | 513 | } |
512 | 514 |
|
513 | | -WorkbenchDB.MissingFileInfoError = class MissingFileInfoError extends Error {}; |
514 | | - |
515 | 515 | module.exports = WorkbenchDB; |
0 commit comments