mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 23:28:39 +08:00
dev: log more information when app icon migration fails
This commit is contained in:
parent
880c2d2a59
commit
eb181b2cd8
@ -277,7 +277,7 @@ class AppIconService extends BaseService {
|
|||||||
const filename = `${data.app_uid}-${size}.png`;
|
const filename = `${data.app_uid}-${size}.png`;
|
||||||
console.log('FILENAME', filename);
|
console.log('FILENAME', filename);
|
||||||
const data_url = data.data_url;
|
const data_url = data.data_url;
|
||||||
const base64 = data_url.split(',')[1];
|
const [metadata, base64] = data_url.split(',');
|
||||||
const input = Buffer.from(base64, 'base64');
|
const input = Buffer.from(base64, 'base64');
|
||||||
|
|
||||||
// NOTE: A stream would be more ideal than a buffer here
|
// NOTE: A stream would be more ideal than a buffer here
|
||||||
@ -292,29 +292,39 @@ class AppIconService extends BaseService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.log.error('Failed to resize icon', {
|
this.log.error('Failed to resize icon', {
|
||||||
app: data.app_uid,
|
app: data.app_uid,
|
||||||
|
metadata,
|
||||||
size,
|
size,
|
||||||
error: e,
|
error: e,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sys_actor = await svc_su.get_system_actor();
|
try {
|
||||||
const hl_write = new HLWrite();
|
const sys_actor = await svc_su.get_system_actor();
|
||||||
await hl_write.run({
|
const hl_write = new HLWrite();
|
||||||
destination_or_parent: dir_app_icons,
|
await hl_write.run({
|
||||||
specified_name: filename,
|
destination_or_parent: dir_app_icons,
|
||||||
overwrite: true,
|
specified_name: filename,
|
||||||
actor: sys_actor,
|
overwrite: true,
|
||||||
user: sys_actor.type.user,
|
actor: sys_actor,
|
||||||
no_thumbnail: true,
|
user: sys_actor.type.user,
|
||||||
file: {
|
no_thumbnail: true,
|
||||||
size: output.length,
|
file: {
|
||||||
name: filename,
|
size: output.length,
|
||||||
mimetype: 'image/png',
|
name: filename,
|
||||||
type: 'image/png',
|
mimetype: 'image/png',
|
||||||
stream: buffer_to_stream(output),
|
type: 'image/png',
|
||||||
},
|
stream: buffer_to_stream(output),
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
this.log.error('Failed to write icon', {
|
||||||
|
app: data.app_uid,
|
||||||
|
metadata,
|
||||||
|
size,
|
||||||
|
error: e,
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})());
|
})());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user