mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-21 13:45:44 +01:00
CCT: no special characters in file names of Coding Contracts
Fixes #4067. The file name of a Coding Contract follows the format contract-xxx-rewardName.cct. The part `xxx` means a sequence of random decimal digits. The part `rewardName` can be an empty string if the player is not part of any faction nor is working for a company. However, if the player is working for a company or faction whose name has a special character, then the special character would also appear in the generated file name. We only want alphanumeric characters throughout the whole file name.
This commit is contained in:
parent
69eda4340e
commit
819e102fe1
@ -191,7 +191,8 @@ function getRandomFilename(server: BaseServer, reward: ICodingContractReward): s
|
||||
}
|
||||
|
||||
if (reward.name) {
|
||||
contractFn += `-${reward.name.replace(/\s/g, "")}`;
|
||||
// Only alphanumeric characters in the reward name.
|
||||
contractFn += `-${reward.name.replace(/[^a-zA-Z0-9]/g, "")}`;
|
||||
}
|
||||
|
||||
return contractFn;
|
||||
|
Loading…
Reference in New Issue
Block a user