From f5d1ab9abb36170bd2c0df3d009c3a4dd6e6ef50 Mon Sep 17 00:00:00 2001 From: IrosTheBeggar Date: Wed, 5 Jul 2017 19:50:28 -0400 Subject: [PATCH] Fixed bug where certain files were returnign with the wrong slash on windows --- modules/db-read/database-public-sqlite.js | 4 +++- modules/file-explorer.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/db-read/database-public-sqlite.js b/modules/db-read/database-public-sqlite.js index ca989e0..2d12428 100644 --- a/modules/db-read/database-public-sqlite.js +++ b/modules/db-read/database-public-sqlite.js @@ -301,9 +301,11 @@ exports.setup = function (mstream, dbSettings){ // Format data for API for(var i in rows ){ var path = String(rows[i]['cast(path as TEXT)']); + var relativePath = fe.relative(req.user.musicDir, path); + relativePath = relativePath.replace(/\\/g, '/') songs.push({ - "filepath": slash(fe.relative(req.user.musicDir, path)), + "filepath": relativePath, "metadata": { "artist": rows[i].artist, "album": rows[i].album, diff --git a/modules/file-explorer.js b/modules/file-explorer.js index 7f17634..cee4544 100644 --- a/modules/file-explorer.js +++ b/modules/file-explorer.js @@ -62,7 +62,8 @@ exports.setup = function(mstream, program){ } } - var returnPath = slash( fe.relative(req.user.musicDir, path) ); + var returnPath = fe.relative(req.user.musicDir, path) ; + returnPath = returnPath.replace(/\\/g, '/'); if(returnPath.slice(-1) !== '/'){ returnPath += '/'; }