Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Ban string values which clash with special prefixes #798

Merged
merged 2 commits into from
Sep 26, 2018
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
status = editor.commit();
break;
case "setString":
status = preferences.edit().putString(key, (String) call.argument("value")).commit();
String value = (String) call.argument("value");
if (value.startsWith(LIST_IDENTIFIER) || value.startsWith(BIG_INTEGER_PREFIX)) {
result.error(
"StorageError",
"This string cannot be stored as it clashes with special identifier prefixes.",
null);
return;
}
status = preferences.edit().putString(key, value).commit();
break;
case "setStringList":
List<String> list = call.argument("value");
Expand Down