From 90c256ed76c85c4ae097859bf6d6d272a2233581 Mon Sep 17 00:00:00 2001 From: Samuel Elliott Date: Fri, 2 Mar 2018 22:24:54 +0000 Subject: [PATCH] Fix relative file path resolution in file settings --- client/src/structs/settings/types/file.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/structs/settings/types/file.js b/client/src/structs/settings/types/file.js index 04fca326..bc43874d 100644 --- a/client/src/structs/settings/types/file.js +++ b/client/src/structs/settings/types/file.js @@ -11,6 +11,7 @@ import { ThemeManager } from 'modules'; import { FileUtils, ClientIPC } from 'common'; import Setting from './basesetting'; +import path from 'path'; export default class FileSetting extends Setting { @@ -35,7 +36,7 @@ export default class FileSetting extends Setting { const files = []; for (let filepath of this.value) { - const buffer = await FileUtils.readFileBuffer(filepath); + const buffer = await FileUtils.readFileBuffer(path.resolve(this.path, filepath)); const type = await FileUtils.getFileType(buffer); files.push(`(data: ${ThemeManager.toSCSSString(buffer.toString('base64'))}, type: ${ThemeManager.toSCSSString(type.mime)}, url: ${ThemeManager.toSCSSString(await FileUtils.toDataURI(buffer, type.mime))})`); }