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

variables: Relax variable name validation #705

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions src/models/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {GObject} = imports.gi;
const {FlatpakSharedModel} = imports.models.shared;
const {FlatsealOverrideStatus} = imports.models.overrideStatus;

var VAR_REGEXP = /^\w+=[\S ]+$/;
var VAR_REGEXP = /^[^;]+=[\S ]+$/;

var FlatpakVariablesModel = GObject.registerClass({
GTypeName: 'FlatpakVariablesModel',
Expand Down Expand Up @@ -75,7 +75,7 @@ var FlatpakVariablesModel = GObject.registerClass({

static deserialize(value) {
return value
.split(/(?=;[\w\s]+=)/)
.split(/(?=;[^;]+=)/)
.map(v => v.replace(/^;/, ''));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/src/testModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ describe('Model', function() {

expect(permissionsDefault.variables).toEqual('TEST=yes');

permissionsDefault.set_property('variables', 'TEST=yes;TE ST=no');
permissionsDefault.set_property('variables', 'TEST=yes;TE;ST=no');
Copy link
Owner Author

@tchx84 tchx84 Jul 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to future self; find a better way to serialize/deserialize this list, in a way that doesn't clash with the actual values...


GLib.timeout_add(GLib.PRIORITY_HIGH, delay + 1, () => {
expect(GLib.access(_environmentOverride, 0)).toEqual(-1);
Expand Down
Loading