Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/providers/history_providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,26 @@ class HistoryMetaStateNotifier
}
}

void addHistoryRequest(HistoryRequestModel model) async {
Future<void> addHistoryRequest(HistoryRequestModel model) async {
final id = model.historyId;
state = {...state ?? {}, id: model.metaData};
final List<String> updatedHistoryKeys = state == null
? [id]
: [...state!.keys, id];
hiveHandler.setHistoryIds(updatedHistoryKeys);
hiveHandler.setHistoryMeta(id, model.metaData.toJson());
await hiveHandler.setHistoryIds(updatedHistoryKeys);
await hiveHandler.setHistoryMeta(id, model.metaData.toJson());
await hiveHandler.setHistoryRequest(id, model.toJson());
await loadHistoryRequest(id);
}

void editHistoryRequest(HistoryRequestModel model) async {
Future<void> editHistoryRequest(HistoryRequestModel model) async {
final id = model.historyId;
state = {...state ?? {}, id: model.metaData};
final existingKeys = state?.keys.toList() ?? [];
if (!existingKeys.contains(id)) {
hiveHandler.setHistoryIds([...existingKeys, id]);
await hiveHandler.setHistoryIds([...existingKeys, id]);
}
hiveHandler.setHistoryMeta(id, model.metaData.toJson());
await hiveHandler.setHistoryMeta(id, model.metaData.toJson());
await hiveHandler.setHistoryRequest(id, model.toJson());
await loadHistoryRequest(id);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/envvar_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ String? substituteVariables(
if (envVarMap.keys.isEmpty) {
return input;
}
final regex = RegExp("{{(${envVarMap.keys.join('|')})}}");
final escapedKeys = envVarMap.keys.map(RegExp.escape).join('|');
final regex = RegExp("{{($escapedKeys)}}");

String result = input.replaceAllMapped(regex, (match) {
final key = match.group(1)?.trim() ?? '';
Expand Down