stricter name filter

This commit is contained in:
Aylur
2023-08-02 18:16:07 +02:00
parent 2d7520c668
commit 2e91cf8e03
2 changed files with 3 additions and 10 deletions
+2 -2
View File
@@ -131,8 +131,8 @@ class MprisPlayer extends GObject.Object {
_cacheCoverArt() {
this.coverPath = MEDIA_CACHE_PATH + '/' +
`${this.trackArtists.join(', ')} - ${this.trackTitle}`
.replace(/[\,\*\?\"\<\>\|\#\:\?\/\'\(\)]/g, '');
`${this.trackArtists.join(', ')}${this.trackTitle}`
.replace(/[^a-zA-Z0-9]/g, '');
if (this.coverPath.length > 255)
this.coverPath = this.coverPath.substring(0, 255);
+1 -8
View File
@@ -180,13 +180,6 @@ class NotificationsService extends Service {
);
}
_filterName(name: string) {
return NOTIFICATIONS_CACHE_PATH +
'/' +
name.replace(/[\ \,\*\?\"\<\>\|\#\:\?\/\!\']/g, '') +
'.png';
}
_readFromFile() {
const file = readFile(NOTIFICATIONS_CACHE_PATH + '/notifications.json');
if (!file)
@@ -212,7 +205,7 @@ class NotificationsService extends Service {
return null;
ensureDirectory();
const fileName = this._filterName(name);
const fileName = name.replace(/[^a-zA-Z0-9]/g, '');
const image = image_data.recursiveUnpack();
const pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(
image[6],