Explicitly convert raw data to strings
As strings are guaranteed to use UTF-8 in the GNOME platform, generic file APIs like g_file_load_contents() return raw data instead. Since gjs' recent update to mozjs60, this data is now returns as Uint8Array which cannot simply be treated as string - its toString() method boils down to arr.join(',') - so use gjs' new ByteArray module to explicitly convert the data. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/179
This commit is contained in:

committed by
Florian Müllner

parent
a9ad91c831
commit
7ca418a79a
@ -112,6 +112,8 @@ function createExtensionObject(uuid, dir, type) {
|
||||
let metadataContents, success, tag;
|
||||
try {
|
||||
[success, metadataContents, tag] = metadataFile.load_contents(null);
|
||||
if (metadataContents instanceof Uint8Array)
|
||||
metadataContents = imports.byteArray.toString(metadataContents);
|
||||
} catch (e) {
|
||||
throw new Error('Failed to load metadata.json: ' + e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user