Skip to content

Commit

Permalink
models: Ensure we're only looking for actual indexed values
Browse files Browse the repository at this point in the history
Issue #613
  • Loading branch information
tchx84 committed Apr 18, 2024
1 parent fe4b38c commit f8a723a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/models/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ var FlatpakPermissionsModel = GObject.registerClass({
const value = keyFile.get_value(group, key);

/* First for models that process the value as a whole */
let model = INDEX[`${group}`] || null;
let model = this.constructor._find(`${group}`);

if (model !== null) {
model.loadFromKeyFile(group, key, value, overrides, global);
Expand All @@ -189,10 +189,10 @@ var FlatpakPermissionsModel = GObject.registerClass({
.split(';');

values.forEach(option => {
model = INDEX[`${group}_${key}_${option.replace('!', '')}`] || null;
model = this.constructor._find(`${group}_${key}_${option.replace('!', '')}`);

if (model === null)
model = INDEX[`${group}_${key}`] || null;
model = this.constructor._find(`${group}_${key}`);

if (model === null && overrides && !global)
model = MODELS.unsupported;
Expand Down Expand Up @@ -443,6 +443,10 @@ var FlatpakPermissionsModel = GObject.registerClass({
return this._appId;
}

static _find(key) {
return Object.hasOwn(INDEX, key) ? INDEX[key] : null;
}

/* testing */

static getGroupForProperty(property) {
Expand Down

0 comments on commit f8a723a

Please sign in to comment.