mirror of
https://github.com/HeyPuter/puter.git
synced 2025-12-31 02:00:13 -06:00
fix: error calling .startsWith on null mime_type
According to the package documentation: https://www.npmjs.com/package/mime > null is returned in cases where an extension is not detected or recognized This call to `.startsWith()` was causing an exception to be thrown upon right-clicking files without an extension, making it impossible to fix them.
This commit is contained in:
@@ -1281,7 +1281,8 @@ function UIItem(options){
|
||||
// -------------------------------------------
|
||||
// Set as Wallpaper
|
||||
// -------------------------------------------
|
||||
const mime_type = mime.getType($(el_item).attr('data-name'));
|
||||
const mime_type = mime.getType($(el_item).attr('data-name')) ??
|
||||
'application/octet-stream';
|
||||
if(!is_trashed && !is_trash && !options.is_dir && mime_type.startsWith('image/')) {
|
||||
menu_items.push({
|
||||
html: i18n('set_as_background'),
|
||||
|
||||
Reference in New Issue
Block a user