fix: escape regex keys in substituteVariables and await Hive writes in history providers#1652
Open
nazifsco wants to merge 1 commit into
Open
fix: escape regex keys in substituteVariables and await Hive writes in history providers#1652nazifsco wants to merge 1 commit into
nazifsco wants to merge 1 commit into
Conversation
…n history providers - envvar_utils.dart: wrap env var keys with RegExp.escape() before building the substitution regex. Keys containing metacharacters like dots (api.key) or plus signs (base+url) previously caused a FormatException crash. Fixes foss42#1642. - history_providers.dart: add await to setHistoryIds() and setHistoryMeta() calls in addHistoryRequest and editHistoryRequest. Without await, a race condition allowed the app to close before the history index was written, causing orphaned records and data loss. Also changed return types from void to Future<void> so callers can await completion. Fixes foss42#1642. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two of the three issues reported in #1642.
Fix 1 -- envvar_utils.dart
substituteVariablesbuilt a regex from env var keys without escaping them. Keys containing regex metacharacters likeapi.key(dot) orbase+url(plus) caused aFormatExceptioncrash before the request was sent.Fix 2 -- history_providers.dart
addHistoryRequestandeditHistoryRequestcalledsetHistoryIds()andsetHistoryMeta()withoutawait. This created a race condition where the app could be closed before the history index was persisted, leaving orphaned records and causing data loss on restart. Also changed both method return types fromvoidtoFuture<void>.Note: the third issue in #1642 (getEnabledRows duplicate row bug) was already fixed in #1465.