mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
Clone dish instead of using the current dish.
Use Dish.STRING instead of "string" for get()
This commit is contained in:
parent
dd5038c15b
commit
86c37bab3f
@ -166,24 +166,25 @@ class Dish {
|
||||
*/
|
||||
async getTitle(maxLength) {
|
||||
let title = "";
|
||||
const cloned = this.clone();
|
||||
|
||||
switch (this.type) {
|
||||
case Dish.FILE:
|
||||
title = this.value.name;
|
||||
title = cloned.value.name;
|
||||
break;
|
||||
case Dish.LIST_FILE:
|
||||
title = `${this.value.length} file(s)`;
|
||||
title = `${cloned.value.length} file(s)`;
|
||||
break;
|
||||
case Dish.ARRAY_BUFFER:
|
||||
case Dish.BYTE_ARRAY:
|
||||
title = await this.detectDishType();
|
||||
title = await cloned.detectDishType();
|
||||
if (title === null) {
|
||||
this.value = this.value.slice(0, 2048);
|
||||
title = await this.get("string");
|
||||
cloned.value = cloned.value.slice(0, 2048);
|
||||
title = await cloned.get(Dish.STRING);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
title = await this.get("string");
|
||||
title = await cloned.get(Dish.STRING);
|
||||
}
|
||||
|
||||
title = title.slice(0, maxLength);
|
||||
|
Loading…
Reference in New Issue
Block a user