mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Imports now specify the file extension to support Node v12
This commit is contained in:
parent
d7d50337f9
commit
566517d20f
469 changed files with 1098 additions and 1093 deletions
|
@ -5,22 +5,20 @@
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
import Utils, { isNodeEnvironment } from "./Utils";
|
||||
import DishError from "./errors/DishError";
|
||||
import Utils, { isNodeEnvironment } from "./Utils.mjs";
|
||||
import DishError from "./errors/DishError.mjs";
|
||||
import BigNumber from "bignumber.js";
|
||||
import { detectFileType } from "./lib/FileType";
|
||||
import { detectFileType } from "./lib/FileType.mjs";
|
||||
import log from "loglevel";
|
||||
|
||||
import {
|
||||
DishByteArray,
|
||||
DishBigNumber,
|
||||
DishFile,
|
||||
DishHTML,
|
||||
DishJSON,
|
||||
DishListFile,
|
||||
DishNumber,
|
||||
DishString,
|
||||
} from "./dishTypes";
|
||||
import DishByteArray from "./dishTypes/DishByteArray.mjs";
|
||||
import DishBigNumber from "./dishTypes/DishBigNumber.mjs";
|
||||
import DishFile from "./dishTypes/DishFile.mjs";
|
||||
import DishHTML from "./dishTypes/DishHTML.mjs";
|
||||
import DishJSON from "./dishTypes/DishJSON.mjs";
|
||||
import DishListFile from "./dishTypes/DishListFile.mjs";
|
||||
import DishNumber from "./dishTypes/DishNumber.mjs";
|
||||
import DishString from "./dishTypes/DishString.mjs";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -234,15 +232,22 @@ class Dish {
|
|||
case Dish.LIST_FILE:
|
||||
title = `${this.value.length} file(s)`;
|
||||
break;
|
||||
case Dish.JSON:
|
||||
title = "application/json";
|
||||
break;
|
||||
case Dish.ARRAY_BUFFER:
|
||||
case Dish.BYTE_ARRAY:
|
||||
title = this.detectDishType();
|
||||
if (title !== null) break;
|
||||
// fall through if no mime type was detected
|
||||
default:
|
||||
cloned = this.clone();
|
||||
cloned.value = cloned.value.slice(0, 256);
|
||||
title = await cloned.get(Dish.STRING);
|
||||
try {
|
||||
cloned = this.clone();
|
||||
cloned.value = cloned.value.slice(0, 256);
|
||||
title = await cloned.get(Dish.STRING);
|
||||
} catch (err) {
|
||||
log.error(`${Dish.enumLookup(this.type)} cannot be sliced. ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
return title.slice(0, maxLength);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue