Skip to content

Commit 23eab63

Browse files
committed
fix: app icon double-encode bug
When getting a stream for an SVG icon from AppIconService with a previously-fetched stored icon provided, a double-encoding bug was preventing a valid image from being obtained.
1 parent a6b9d33 commit 23eab63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/src/modules/apps/AppIconService.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ class AppIconService extends BaseService {
9898
async get_icon_stream ({ app_icon, app_uid, size, tries = 0 }) {
9999
// If there is an icon provided, and it's an SVG, we'll just return it
100100
if ( app_icon ) {
101-
const metadata = app_icon.split(',')[0];
101+
const [metadata, data] = app_icon.split(',');
102102
const input_mime = metadata.split(';')[0].split(':')[1];
103103

104104
// svg icons will be sent as-is
105105
if (input_mime === 'image/svg+xml') {
106106
return {
107107
mime: 'image/svg+xml',
108108
get stream () {
109-
return buffer_to_stream(Buffer.from(app_icon));
109+
return buffer_to_stream(Buffer.from(data, 'base64'));
110110
},
111111
data_url: app_icon,
112112
}

0 commit comments

Comments
 (0)