networkAgent: Fix another ByteArray => Uint8Array instance

This was missed in commit 7ca418a79a. As we are dealing with
non-\0-terminated data here, go through GBytes this time.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/189
This commit is contained in:
Florian Müllner 2018-08-02 23:54:08 +02:00 committed by Florian Müllner
parent 02d06bb1f3
commit afe5703710

View File

@ -506,8 +506,12 @@ var VPNRequestHandler = new Lang.Class({
try {
data = this._dataStdout.peek_buffer();
keyfile.load_from_data(data.toString(), data.length,
GLib.KeyFileFlags.NONE);
if (data instanceof Uint8Array)
data = imports.byteArray.toGBytes(data);
else
data = data.toGBytes();
keyfile.load_from_bytes(data, GLib.KeyFileFlags.NONE);
if (keyfile.get_integer(VPN_UI_GROUP, 'Version') != 2)
throw new Error('Invalid plugin keyfile version, is %d');