Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues when uri match is a string #5332

Merged
merged 1 commit into from
Dec 29, 2024
Merged
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
8 changes: 8 additions & 0 deletions src/db/models/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ impl Cipher {
// Set the first element of the Uris array as Uri, this is needed several (mobile) clients.
if self.atype == 1 {
if type_data_json["uris"].is_array() {
// Fix uri match values first, they are only allowed to be a number or null
// If it is a string, convert it to null since all clients do not allow strings anyway
let uri_count = type_data_json["uris"].as_array().unwrap().len();
for n in 0..uri_count {
if type_data_json["uris"][n]["match"].is_string() {
type_data_json["uris"][n]["match"] = Value::Null;
}
}
let uri = type_data_json["uris"][0]["uri"].clone();
type_data_json["uri"] = uri;
} else {
Expand Down